コード例 #1
0
        public void CarUpdate()
        {
            Console.Clear();
            CarsView();
            Console.WriteLine("Enter the Model ID of the car you'd like to update.");
            int originalId = int.Parse(Console.ReadLine());

            KomodoGreen updatedCar = new KomodoGreen();

            Console.WriteLine("Enter the number assocated with the updated car type.\n" +
                              "1. Electric\n" +
                              "2. Hybrid\n" +
                              "3. Gas");
            updatedCar.CarType = (CarTypeEnum)int.Parse(Console.ReadLine());

            Console.WriteLine("Enter the updated name of the car.");
            updatedCar.Name = Console.ReadLine();

            Console.WriteLine("Enter the updated details for the car.");
            updatedCar.Details = Console.ReadLine();

            bool wasUpdated = _carRepo.UpdateCar(originalId, updatedCar);

            if (wasUpdated)
            {
                Console.WriteLine("Car was successfully updated!");
            }
            else
            {
                Console.WriteLine("Could not be updated. Try again.");
            }
        }
コード例 #2
0
 public void KomodoGreenRepo_UpdateCar_ShouldBeTrue()
 {
     Assert.IsTrue(_carRepo.UpdateCar(_car1.ModelId, _car3));
 }