public async void TestLeaderBoardCalculation() { // Setup var totalTimes = new[] { 2.2, 1.1, 3.3, 0.0, 0.0 }; var runDaoMock = new Mock <IRunDao>(); runDaoMock.Setup(d => d.GetAllRunsForRace(It.IsAny <Race>(), It.IsAny <int>())) .Returns(Task.FromResult( totalTimes.Select(t => new Run { TotalTime = t }) )); var daoProvider = DaoProviderHelper.GetPartialDaoProvider(runDao: runDaoMock.Object); var runService = new RunService(daoProvider, new SimulatorRaceClock()); // Execute var leaderBoard = (await runService.GetLeaderBoard(null, 1)).ToArray(); // Assert Assert.Equal(totalTimes.Length, leaderBoard.Length); Assert.Equal(1.1, leaderBoard[0].TotalTime); Assert.Equal(2.2, leaderBoard[1].TotalTime); Assert.Equal(3.3, leaderBoard[2].TotalTime); Assert.Equal(0.0, leaderBoard[3].TotalTime); Assert.Equal(0.0, leaderBoard[4].TotalTime); }