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); }
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>()); }
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)); }
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); }