public void GetAverageDataTest()
        {
            Driver newDriver = new Driver(00003, "John Smith-Jones", new DriverData(3, 3, 1, 1));
            Driver driver    = new Driver(00002, "Eric Jones", new DriverData(5, 0, 1, 2));

            _insuranceRepo.AddDriverToDict(newDriver);
            _insuranceRepo.AddDriverToDict(driver);
            List <DriverData> dataList = _insuranceRepo.GetDriverData();

            DriverData averageData = _insuranceRepo.GetAverageData(dataList);

            Assert.AreEqual(6, averageData.SpeedingFrequency);
        }
Пример #2
0
        private void ShowAverage()
        {
            List <DriverData> driverData    = _insuranceRepo.GetDriverData();
            DriverData        average       = _insuranceRepo.GetAverageData(driverData);
            Driver            averageDriver = new Driver(999999, "average", average);

            Console.WriteLine($"On average our drivers are {averageDriver.DriverClass}.\n" +
                              $"Average percentage of time speeding: {average.SpeedingFrequency}%\n" +
                              $"Average percentage of time spent out of lane: {average.OutOfLaneFrequency}%\n" +
                              $"Average percentage of time spent following too closely: {average.FollowingTooCloselyFrequency}%\n" +
                              $"Average number of times rolling through stop signs: {average.TimesRollingThroughStopSign}\n" +
                              $"Press any key to continue...");
            Console.ReadKey();
        }