Created
October 24, 2013 12:48
-
-
Save jbogard/7136623 to your computer and use it in GitHub Desktop.
This file contains 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
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"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?