internal void CalculateReferenceTime_AsSpecificDriver_FromRaceData(ReferenceTimeCalculator referenceTimeCalculator,
                                                                           DriverCodeGenerator driverCodeGenerator,
                                                                           LapDataGenerator lapDataGenerator,
                                                                           string team)
        {
            var(drivers, raceData) = BuildRaceData(driverCodeGenerator, lapDataGenerator, team);
            referenceTimeCalculator.SetStrategy(new SpecificDriverAverageReferenceTimeStrategy(drivers.ToArray()[2].DriverCode));
            var referenceTime = referenceTimeCalculator.Calculate(drivers, raceData);

            Assert.Equal(TimeSpan.FromSeconds(17), referenceTime.Time);
        }
        internal void CalculateReferenceTime_AsWinnerAverage_FromRaceData(ReferenceTimeCalculator referenceTimeCalculator,
                                                                          RaceWinnerAverageReferenceTimeStrategy raceWinnerAverageReferenceTimeStrategy,
                                                                          DriverCodeGenerator driverCodeGenerator,
                                                                          LapDataGenerator lapDataGenerator,
                                                                          string team)
        {
            var(drivers, raceData) = BuildRaceData(driverCodeGenerator, lapDataGenerator, team);
            referenceTimeCalculator.SetStrategy(raceWinnerAverageReferenceTimeStrategy);
            var referenceTime = referenceTimeCalculator.Calculate(drivers, raceData);

            Assert.Equal(TimeSpan.FromSeconds(2), referenceTime.Time);
        }
예제 #3
0
 private ReferenceTime CalculateReferenceTime(IReadOnlyCollection <Driver> drivers, RaceData raceData)
 {
     return(_referenceTimeCalculator.Calculate(drivers, raceData));
 }