Created
November 28, 2012 04:52
-
-
Save jmarnold/4159088 to your computer and use it in GitHub Desktop.
Defining Test Inputs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public IEnumerable<Error> Errors { get; set; } | |
} | |
public class Error | |
{ | |
public string Code { get; set; } | |
public string Message { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFixture : Fixture | |
{ | |
public IGrammar ThePeopleAre() | |
{ | |
return CreateNewObject(x => { | |
x.SetProperty(person => person.FirstName); | |
x.SetProperty(person => person.LastName); | |
// This gives us the "Errors" column and let's us do whatever we want with the string input | |
x.WithInput<string>("Errors").Configure((person, errors) => { | |
person.Errors = ErrorParser.Parse(errors); // could do something fancier here too | |
}); | |
x.Do = (person) => _repository.Update(person); | |
}).AsTable("The people are"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment