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

            newCar.totalCountOfRents = 1;
            int expected = 2;

            car.addCountOfRents(newCar);

            Assert.AreEqual(expected, newCar.totalCountOfRents);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #6
0
 public static bool checkAvailableStatus(car Car, DateTime expectedDate)
 {
     if (Car.availabilityDate <= expectedDate)
     {
         Car.availableStatus = true;
     }
     else
     {
         Car.availableStatus = false;
     }
     return(Car.availableStatus);
 }
Example #7
0
 public static car sendCarToCheckup(car Car)
 {
     Car.availabilityDate = Car.availabilityDate.AddDays(7);
     return(Car);
 }
Example #8
0
        //public static void addCar()
        //{

        //}

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