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)); }
public void TestThat_Index_DoesNotCalculateTheNumberOfDaysOfVotingPassedGreaterThanTheTotalNumberOfAllowableVotingDays() { var dataProvider = new DataProviderBuilder() .WithNumberOfDaysSinceVotingOpened(25) .WithNumberOfDaysOfVoting(10) .Build(); var controller = new VotingControllerBuilder().WithDataProvider(dataProvider).Build(); var model = controller.Index().GetViewModel <VotingStatsViewModel>(); Assert.That(model.NumberOfDaysOfVotingPassed, Is.EqualTo(10)); }
public void TestThat_Index_DoesNotCalculateGreaterThanOneHunderdPercent_ForTheDurationThroughTheVotingPeriod() { var dataProvider = new DataProviderBuilder() .WithNumberOfDaysSinceVotingOpened(25) .WithNumberOfDaysOfVoting(10) .Build(); var controller = new VotingControllerBuilder().WithDataProvider(dataProvider).Build(); var model = controller.Index().GetViewModel <VotingStatsViewModel>(); Assert.That(model.VotingCompletePercentage, Is.EqualTo(100)); }
public void TestThat_Index_CalculatesTheCorrectPercentage_ForTheDurationThroughTheVotingPeriod( int numberOfDaysSinceVotingOpened, int numberOfDaysVoting, int expectedPercentageCompletion) { var dataProvider = new DataProviderBuilder() .WithNumberOfDaysSinceVotingOpened(numberOfDaysSinceVotingOpened) .WithNumberOfDaysOfVoting(numberOfDaysVoting) .Build(); var controller = new VotingControllerBuilder().WithDataProvider(dataProvider).Build(); var model = controller.Index().GetViewModel <VotingStatsViewModel>(); Assert.That(model.VotingCompletePercentage, Is.EqualTo(expectedPercentageCompletion)); }