Exemplo n.º 1
0
        public void TestThat_Leaderboard_LimitsTheNumberOfSessions()
        {
            var dataProvider = new DataProviderBuilder().WithLeaderboard(new[] { new SessionLeaderBoardEntry() }).Build();
            var controller   = new VotingControllerBuilder().WithDataProvider(dataProvider).Build();

            controller.Leaderboard(123);

            dataProvider.Received().GetLeaderBoard(123, Arg.Any <bool>());
        }
Exemplo n.º 2
0
        public void TestThat_Leaderboard_ForbidsDuplicateSpeakers()
        {
            var dataProvider = new DataProviderBuilder().WithLeaderboard(new[] { new SessionLeaderBoardEntry() }).Build();
            var controller   = new VotingControllerBuilder().WithDataProvider(dataProvider).Build();

            controller.Leaderboard(123, false);

            dataProvider.Received().GetLeaderBoard(Arg.Any <int>(), false);
        }
Exemplo n.º 3
0
        public void TestThat_Leaderboard_SetsTheSessionsObtainedFromTheDataProviderOnTheModel()
        {
            var sessions     = new[] { new SessionLeaderBoardEntry(), new SessionLeaderBoardEntry() };
            var dataProvider = new DataProviderBuilder().WithLeaderboard(sessions).Build();
            var controller   = new VotingControllerBuilder().WithDataProvider(dataProvider).Build();

            var model = controller.Leaderboard().GetViewModel <LeaderboardViewModel>();

            CollectionAssert.AreEquivalent(sessions, model.Sessions);
        }
Exemplo n.º 4
0
        public void TestThat_Leaderboard_SetsTheHighestOccuringNumberOfVotesOnTheModel()
        {
            var sessions = new[] { new SessionLeaderBoardEntry {
                                       NumberOfVotes = 2
                                   }, new SessionLeaderBoardEntry {
                                       NumberOfVotes = 4
                                   } };
            var dataProvider = new DataProviderBuilder().WithLeaderboard(sessions).Build();
            var controller   = new VotingControllerBuilder().WithDataProvider(dataProvider).Build();

            var model = controller.Leaderboard().GetViewModel <LeaderboardViewModel>();

            Assert.That(model.HighestVoteCount, Is.EqualTo(4));
        }