Create a gist now

Instantly share code, notes, and snippets.

var conference = new Conference("CodeMash");
var attendee = new Attendee("Bob", "Joe") { Email = "bob@bob.com" };
attendee.RegisterFor(conference);
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 = "foo@foo.com"
}
}
};
var controller = fixture.CreateInstance<ConferenceController>();
var result = controller.Edit(model);
fixture.CommitTransaction();
conference = fixture.GetById<Conference>(conference.Id);
conference.Name.ShouldEqual(model.Name);
attendee = fixture.GetById<Attendee>(attendee.Id);
attendee.FirstName.ShouldEqual(model.Attendees[0].FirstName);
attendee.LastName.ShouldEqual(model.Attendees[0].LastName);
attendee.Email.ShouldEqual(model.Attendees[0].Email);
result.ShouldBeRedirectTo<ConferenceController>(c => c.Index(null), "Default");
@darrencauthon

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