コード例 #1
0
        public void VotingLink_ShouldBeHidden_ByDefault()
        {
            var conferenceLoader = new ConferenceLoaderBuilder().Build();

            var model = new AdminHomeController(conferenceLoader)
                            .Index().GetViewModel<MenuViewModel>();

            Assert.That(model.ShowVotingStatsLink, Is.False);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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"));
        }
コード例 #6
0
        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("~/"));
        }
コード例 #7
0
        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"));
        }
コード例 #8
0
        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"));
        }
コード例 #9
0
        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>());
        }
コード例 #10
0
        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));
        }