public async void TestInterimTimesCalculation() { // Setup var timestamps = new[] { 1576850000.000, 1576850001.111, 1576850002.222 }; var sensorMeasurementDaoMock = new Mock <ISensorMeasurementDao>(); sensorMeasurementDaoMock.Setup(d => d.GetMeasurementsForRun(It.IsAny <Run>())) .Returns(Task.FromResult( timestamps.Select(t => new SensorMeasurement { Timestamp = t }) )); var runDaoMock = new Mock <IRunDao>(); runDaoMock.Setup(d => d.GetBySkierAndRace(It.IsAny <Race>(), It.IsAny <int>(), It.IsAny <Skier>())) .Returns(Task.FromResult(new Run())); var daoProvider = DaoProviderHelper.GetPartialDaoProvider( sensorMeasurementDao: sensorMeasurementDaoMock.Object, runDao: runDaoMock.Object ); var runService = new RunService(daoProvider, new SimulatorRaceClock()); // Execute var calculatedTimespans = (await runService.GetInterimTimes(null, 1, null)).ToArray(); // Assert Assert.Equal(timestamps.Length - 1, calculatedTimespans.Length); Assert.Equal(calculatedTimespans[0], TimeSpan.FromSeconds(timestamps[1] - timestamps[0])); Assert.Equal(calculatedTimespans[1], TimeSpan.FromSeconds(timestamps[2] - timestamps[0])); }