Esempio n. 1
0
        private void UpdateElectric()
        {
            GetListOfElectric();
            Console.WriteLine("\nEnter the Model of the electric car to be updated");
            string oldModel = Console.ReadLine();

            Console.Clear();
            Electric newElectric = new Electric();

            Console.WriteLine("Enter the Make");
            newElectric.Make = Console.ReadLine();
            Console.WriteLine("Enter the Model");
            newElectric.Model = Console.ReadLine();
            Console.WriteLine("Enter fuel efficiency information");
            newElectric.FuelEfficiency = Console.ReadLine();
            bool wasUpdated = electric_Repo.UpdateExistingElectric(oldModel, newElectric);

            if (wasUpdated)
            {
                Console.WriteLine("Electric Car updated!");
            }
            else
            {
                Console.WriteLine("Could not update Electric Car.");
            }
        }
        //update
        public void UpdateExistingElectric_ShouldReturnTrue()
        {
            //arrange
            Electric newElectric = new Electric("Tesla", "Model 3", "30kWh/100mi");
            //act
            bool updateElectric = _repo.UpdateExistingElectric("Model 3", newElectric);

            //assert
            Assert.IsTrue(updateElectric);
        }