public void Should_update_the_attendee_count_when_adding_an_attendee() { var conference = new Conference("Something"); var attendee = new Attendee("Foo", "Bar"); attendee.RegisterFor(conference); conference.AttendeeCount.ShouldEqual(1); }
public void Should_create_attendee_association_when_registering_for_an_event() { var conference = new Conference("Austin Code Camp"); var attendee = new Attendee("Joe", "Schmoe"); attendee.RegisterFor(conference); attendee.Conference.ShouldEqual(conference); conference.GetAttendees().Any(a => a == attendee).ShouldBeTrue(); }
public void Should_cascade_attendee() { var attendee = new Attendee("Joe", "Schmoe"); var newEvent = new Conference("Some event"); attendee.RegisterFor(newEvent); SaveEntities(newEvent); var loaded = SessionSource.CreateSession().Load <Conference>(newEvent.Id); loaded.GetAttendees().Count().ShouldEqual(1); loaded.GetAttendees().ElementAt(0).Conference.ShouldEqual(loaded); }
public void Should_cascade_attendee() { var attendee = new Attendee("Joe", "Schmoe"); var newEvent = new Conference("Some event"); attendee.RegisterFor(newEvent); SaveEntities(newEvent); var loaded = SessionSource.CreateSession().Load<Conference>(newEvent.Id); loaded.GetAttendees().Count().ShouldEqual(1); loaded.GetAttendees().ElementAt(0).Conference.ShouldEqual(loaded); }
public ActionResult Register(AttendeeEditModel model) { if (ModelState.IsValid) { var entity = _repository.GetById(model.ConferenceId); var attendee = new Attendee(model.FirstName, model.LastName) { Email = model.Email }; attendee.RegisterFor(entity); return(RedirectToAction("AttendeeConfirmation", model)); } return(View(model)); }