public void Can_persist()
        {
            var userGroup = new UserGroup {Name = "user group"};
            var meeting = new Meeting
                          	{
                          		Name = "sdf",
                          		Description = "description",
                          		StartDate = new DateTime(2008, 12, 2),
                          		EndDate = new DateTime(2008, 12, 3),
                          		LocationName = "St Edwards Professional Education Center",
                          		Address = "12343 Research Blvd",
                          		City = "Austin",
                          		Region = "Tx",
                          		PostalCode = "78234",
                                                TimeZone = "CST",
                                                UserGroup = userGroup,
                          		LocationUrl = "http://foobar",
                          		Topic = "topic",
                          		Summary = "summary",
                          		SpeakerName = "speakername",
                          		SpeakerBio = "bio",
                          		SpeakerUrl = "http://google.com"
                          	};

            AssertObjectCanBePersisted(userGroup);
            AssertObjectCanBePersisted(meeting);
        }
		public void Should_render_meeting_announcement_for_meeting()
		{
			var meeting = new Meeting();
			var controller = new EventController(null);

			ViewResult result = controller.Announcement(meeting);
	
			result.ViewName.ShouldEqual("Meeting" + EventController.ANNOUNCEMENT_PARTIAL_SUFFIX);
			result.ViewData.Model.ShouldEqual(meeting);
			((AutoMappedViewResult)result).ViewModelType.ShouldEqual(typeof(MeetingAnnouncementDisplay));
		}
		public void Should_list_all_events_for_usergroup()
		{
			var repository = S<IEventRepository>();
			var usergroup = new UserGroup();
			var meeting = new Meeting {Key = "meeting1"};
			var conference = new Conference {Key = "conference1"};
			repository.Stub(s => s.GetAllForUserGroup(usergroup)).Return(new Event[] {meeting, conference});

			var controller = new EventController(repository);
			ViewResult result = controller.List(usergroup);
			result.ViewName.ShouldEqual("list");
			result.ViewData.Model.ShouldEqual(new[] {"meeting1", "conference1"});
		}
        public void Should_retrieve_all_upcoming_events()
        {
            SystemClockFactory.Default = () => new Clock(new DateTime(2009, 5, 5));
            var usergroup = new UserGroup();
            var usergroup1 = new UserGroup();
            var event1 = new Conference
                              	{
                              		UserGroup = usergroup1,
                              		StartDate = new DateTime(2000, 1, 2),
                              		EndDate = new DateTime(2009, 4, 6)
                              	};
            var event4 = new Meeting
                              	{
                              		UserGroup = usergroup,
                              		StartDate = new DateTime(2000, 1, 3),
                              		EndDate = new DateTime(2009, 5, 4, 20, 0, 0)
                              	};
            var event2 = new Conference
                              	{
                              		UserGroup = usergroup1,
                              		StartDate = new DateTime(2000, 1, 4),
                              		EndDate = new DateTime(2009, 5, 5, 20, 0, 0)
                              	};
            var event3 = new Meeting
                              	{
                              		UserGroup = usergroup,
                              		StartDate = new DateTime(2000, 1, 5),
                              		EndDate = new DateTime(2009, 5, 7)
                              	};

            using (ISession session = GetSession())
            {
                session.SaveOrUpdate(usergroup);
                session.SaveOrUpdate(usergroup1);
                session.SaveOrUpdate(event1);
                session.SaveOrUpdate(event2);
                session.SaveOrUpdate(event3);
                session.SaveOrUpdate(event4);
                session.Flush();
            }

            IEventRepository repository = GetInstance<EventRepository>();
            Event[] events = repository.GetAllFutureEvents();

            events.Length.ShouldEqual(2);
            events[0].ShouldEqual(event2);
        }
		public void Should_list_all_future_events()
		{
			var repository = S<IEventRepository>();
			var userGroup1 = new UserGroup {Name = "foo", DomainName = "bar"};
			var meeting = new Meeting
			              	{
			              		Key = "meeting1",
			              		Name = "monthly meeting",
			              		Topic = "Visual Studio Tips and Tricks",
			              		UserGroup = userGroup1
			              	};
			var conference = new Conference {Key = "conference1", Name = "Austin Code Camp", UserGroup = userGroup1};
			repository.Stub(s => s.GetAllFutureEvents()).Return(new Event[] {meeting, conference});

			var controller = new EventController(repository);
			ViewResult result = controller.AllUpcomingEvents();
			result.ViewName.ShouldEqual("");
			result.ViewData.Model.ShouldBeInstanceOf<EventList[]>();
		}
		public void DeleteMeeting_message_should_delete_a_meeting()
		{
			DependencyRegistrar.EnsureDependenciesRegistered();
			AutoMapperConfiguration.Configure();
			ObjectFactory.Inject(typeof (IUnitOfWork), S<IUnitOfWork>());

			var repository = S<IRepository<Meeting>>();
			var meeting = new Meeting();
			repository.Stub(repository1 => repository1.GetById(Guid.Empty)).IgnoreArguments().Return(meeting);
			ObjectFactory.Inject(typeof (IRepository<Meeting>), repository);
			ObjectFactory.Inject(typeof (IMeetingRepository), S<IMeetingRepository>());

			RulesEngineConfiguration.Configure(typeof (UpdateUserConfiguration));
			var rulesRunner = new RulesEngine();

			var result = rulesRunner.Process(new DeleteMeetingInput {Meeting = Guid.NewGuid()},
			                                 typeof (DeleteMeetingInput));
			result.Successful.ShouldBeTrue();
			result.ReturnItems.Get<Meeting>().ShouldEqual(meeting);
		}
        public void should_retrieve_events_for_a_usergroup()
        {
            var usergroup = new UserGroup();
            var conference1 = new Conference {UserGroup = usergroup};
            var meeting1 = new Meeting {UserGroup = usergroup};
            var meeting2 = new Meeting();

            using (ISession session = GetSession())
            {
                session.SaveOrUpdate(usergroup);
                session.SaveOrUpdate(conference1);
                session.SaveOrUpdate(meeting1);
                session.SaveOrUpdate(meeting2);
                session.Flush();
            }

            IEventRepository repository = GetInstance<EventRepository>();
            Event[] events = repository.GetAllForUserGroup(usergroup);

            events.Length.ShouldEqual(2);
        }
 public ActionResult Edit(Meeting meeting, UserGroup usergroup)
 {
     return AutoMappedView<MeetingInput>(meeting ?? new Meeting {UserGroup = usergroup});
 }