Пример #1
0
        public void Should_construct_attendee_with_first_and_last_name()
        {
            var attendee = new Attendee("Joe", "Schmoe");

            attendee.FirstName.ShouldEqual("Joe");
            attendee.LastName.ShouldEqual("Schmoe");
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #5
0
        public void Should_map_attendee_fields()
        {
            var attendee = new Attendee("Joe", "Schmoe")
            {
                Email = "*****@*****.**"
            };

            SaveEntities(attendee);

            var loaded = SessionSource.CreateSession().Load<Attendee>(attendee.Id);

            loaded.FirstName.ShouldEqual(attendee.FirstName);
            loaded.LastName.ShouldEqual(attendee.LastName);
            loaded.Email.ShouldEqual(attendee.Email);
        }
Пример #6
0
        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);
        }
 protected internal virtual void AddAttendee(Attendee attendee)
 {
     _attendees.Add(attendee);
     AttendeeCount++;
 }