Пример #1
0
        private void AddDriver()
        {
            Console.Write("Please enter the Driver ID: ");
            int driverID = int.Parse(Console.ReadLine());

            Console.Write("Enter the name of the Driver:");
            string driverName = Console.ReadLine();

            Console.Write("Enter the percentage of time speeding as a whole number: ");
            int timeSpeeding = int.Parse(Console.ReadLine());

            Console.Write("Enter the percentage of time spent out of lane: ");
            int timeOutOfLane = int.Parse(Console.ReadLine());

            Console.Write("Enter the percentage of time following too closely: ");
            int timeClose = int.Parse(Console.ReadLine());

            Console.Write("Enter the number of times rolling through stop signs: ");
            int    rollingStop = int.Parse(Console.ReadLine());
            Driver newDriver   = new Driver(driverID, driverName, new DriverData(timeSpeeding, timeOutOfLane, timeClose, rollingStop));

            _insuranceRepo.AddDriverToDict(newDriver);
            Console.WriteLine($"{newDriver.DriverName} has a safety score of {newDriver.SafetyScore}.\n" +
                              $"They are a {newDriver.DriverClass} driver. Their premium will be {newDriver.Premium}\n" +
                              $"Press any key to continue...");
            Console.ReadKey();
        }
        public void AddDriverToDictTest()
        {
            Driver driver = new Driver(00002, "Eric Jones", new DriverData(5, 0, 1, 2));

            _insuranceRepo.AddDriverToDict(driver);

            int expected = 2;
            int actual   = _insuranceRepo.GetFullDriverDict().Count;

            Assert.AreEqual(expected, actual);
        }
 public void Arrange()
 {
     _insuranceRepo = new SmartInsuranceRepository();
     _driver        = new Driver(00001, "John Smith", new DriverData(10, 1, 3, 5));
     _insuranceRepo.AddDriverToDict(_driver);
 }