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

            newCar.totalCountOfRents = 1;
            int expected = 2;

            car.addCountOfRents(newCar);

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

        //}

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