Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created November 28, 2012 04:52
Show Gist options
  • Save jmarnold/4159088 to your computer and use it in GitHub Desktop.
Save jmarnold/4159088 to your computer and use it in GitHub Desktop.
Defining Test Inputs
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; }
}
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