Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
var conference = new Conference("CodeMash");
var attendee = new Attendee("Bob", "Joe") { Email = "" };
fixture.SaveAll(conference, attendee);
var model = new ConferenceEditModel {
Id = conference.Id,
Name = "BUILD",
Attendees = new[] {
new ConferenceEditModel.AttendeeModel {
Id = attendee.Id,
FirstName = "George",
LastName = "Smith",
Email = ""
var controller = fixture.CreateInstance<ConferenceController>();
var result = controller.Edit(model);
conference = fixture.GetById<Conference>(conference.Id);
attendee = fixture.GetById<Attendee>(attendee.Id);
result.ShouldBeRedirectTo<ConferenceController>(c => c.Index(null), "Default");

I put this comment in on the blog, but just to repeat it...

How does the assertion on line 33 pass? Your'e setting the attendee email address with a setter, and there's no "save" on the object afterwards. How can this test pass?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment