public void VotingLink_ShouldBeHidden_ByDefault() { var conferenceLoader = new ConferenceLoaderBuilder().Build(); var model = new AdminHomeController(conferenceLoader) .Index().GetViewModel<MenuViewModel>(); Assert.That(model.ShowVotingStatsLink, Is.False); }
public void VotingLink_ShouldBeVisible_WhenVotingIsOpen() { var conferenceLoader = new ConferenceLoaderBuilder() .WithVotingOpen() .Build(); var model = new AdminHomeController(conferenceLoader) .Index().GetViewModel<MenuViewModel>(); Assert.That(model.ShowVotingStatsLink, Is.True); }
public void VotingLink_ShouldBeHidden_WhenSessionSubmissionIsOpen() { var conferenceLoader = new ConferenceLoaderBuilder() .WithSessionSubmissionOpen() .Build(); var model = new AdminHomeController(conferenceLoader) .Index().GetViewModel<MenuViewModel>(); Assert.That(model.ShowVotingStatsLink, Is.False); }
public void SubmitSessionLinks_ShouldBeHidden_WhenSessionSubmissionIsNotOpen() { var conferenceLoader = new ConferenceLoaderBuilder() .WithSessionSubmissionClosed() .Build(); var homeController = CreateHomeController(conferenceLoader); var model = homeController.About().GetViewModel<AboutViewModel>(); Assert.That(model.ShowSessionSubmissionLink, Is.False); }
public void Register_ShouldRedirectBackToIndex_WhenRegistrationIsNotOpen() { var conferenceLoader = new ConferenceLoaderBuilder() .WithRegistrationNotOpen() .Build(); var homeController = CreateHomeController(conferenceLoader); var viewName = homeController.Agenda().GetRedirectionViewName(); Assert.That(viewName, Is.EqualTo("Index")); }
public void Preview_ShouldRedirectToTheHomePage_WhenTheConferenceIsNotInPreview() { var conferenceLoader = new ConferenceLoaderBuilder() .NotInPreview() .Build(); var homeController = CreateHomeController(conferenceLoader); var result = homeController.Preview(); Assert.That(result.GetRedirectionUrl(), Is.EqualTo("~/")); }
public void Agenda_ShouldRedirectBackToIndex_WhenTheAgendaCannotBePublished() { var conferenceLoader = new ConferenceLoaderBuilder() .WithAgendaNotPublished() .Build(); var homeController = CreateHomeController(conferenceLoader); var viewName = homeController.Agenda().GetRedirectionViewName(); Assert.That(viewName, Is.EqualTo("Index")); }
public void Filter_RedirectsToClosedPage_WhenTheConferenceIsClosed() { var conferenceLoader = new ConferenceLoaderBuilder() .WhenClosed() .Build(); var filterAttribute = new ConferenceIsClosedFilter(conferenceLoader); var filterContext = new ActionExecutingContext(); filterAttribute.OnActionExecuting(filterContext); Assert.That(filterContext.Result.GetRedirectionUrl(), Contains.Substring("Closed")); }
public void Filter_DoesNotRedirectToClosedPage_WhenTheConferenceIsNotClosed() { var conferenceLoader = new ConferenceLoaderBuilder() .WhenNotClosed() .Build(); var filterAttribute = new ConferenceIsClosedFilter(conferenceLoader); var filterContext = new ActionExecutingContext(); filterAttribute.OnActionExecuting(filterContext); Assert.That(filterContext.Result, Is.Not.InstanceOf<RedirectResult>()); }
public void TestThat_Leaderboard_SetsTheCorrectNumberOfTotalSessionsForTheConference() { var conferenceLoader = new ConferenceLoaderBuilder().WithTotalNumberOfSessions(12).Build(); var controller = new VotingControllerBuilder().WithConferenceLoader(conferenceLoader).Build(); var model = controller.Index().GetViewModel<VotingStatsViewModel>(); Assert.That(model.TotalNumberOfSessions, Is.EqualTo(12)); }