public static car checkСheckupNeed(car Car)
 {
     if (Car.totalCountOfRents % 10 == 0)
     {
         Car.totalCountOfRents = 0;
         sendCarToCheckup(Car);
     }
     return(Car);
 }
Beispiel #2
0
        public void addCountOfRents_CountPlusOne()
        {
            car newCar = new car();

            newCar.totalCountOfRents = 1;
            int expected = 2;

            car.addCountOfRents(newCar);

            Assert.AreEqual(expected, newCar.totalCountOfRents);
        }
Beispiel #3
0
        public void sendCarToCheckup_availabilityDatePlus7Days()
        {
            car newCar = new car();

            newCar.availabilityDate = new DateTime(2018, 1, 1);
            DateTime expected = new DateTime(2018, 1, 8);

            car.sendCarToCheckup(newCar);

            Assert.AreEqual(expected, newCar.availabilityDate);
        }
Beispiel #4
0
        public void checkСheckupNeed_CountEqualCurrentCount()
        {
            car newCar = new car();

            newCar.totalCountOfRents = 8;
            int expected = 8;

            car.checkСheckupNeed(newCar);

            Assert.AreEqual(expected, newCar.totalCountOfRents);
        }
Beispiel #5
0
        public void checkAvailableStatus_AvailableStatusFalse()
        {
            car newCar = new car();

            newCar.availabilityDate = new DateTime(2020, 1, 1);
            DateTime expectedDate = new DateTime(2019, 1, 1);

            bool expected = false;
            bool result   = car.checkAvailableStatus(newCar, expectedDate);

            Assert.AreEqual(expected, result);
        }
 public static bool checkAvailableStatus(car Car, DateTime expectedDate)
 {
     if (Car.availabilityDate <= expectedDate)
     {
         Car.availableStatus = true;
     }
     else
     {
         Car.availableStatus = false;
     }
     return(Car.availableStatus);
 }
 public static car sendCarToCheckup(car Car)
 {
     Car.availabilityDate = Car.availabilityDate.AddDays(7);
     return(Car);
 }
        //public static void addCar()
        //{

        //}

        public static car addCountOfRents(car Car)
        {
            Car.totalCountOfRents++;
            checkСheckupNeed(Car);
            return(Car);
        }