public void RemoveCarFromList() { GreenRepository _greenRepo = new GreenRepository(); Car car = new Car(CarType.Gas, "Honda", "Accord", 2009, 4, 256); Car carTwo = new Car(); _greenRepo.AddCarToList(car); _greenRepo.AddCarToList(carTwo); _greenRepo.RemoveCarFromList(256); int actual = _greenRepo.SeeAllCarsOnList().Count; int expected = 1; Assert.AreEqual(expected, actual); }
public void AddAndRemoveCarInfo() { GreenRepository repoInfo = new GreenRepository(); GreenPlan customerInfo = new GreenPlan(1, 2015, "Honda", "Sonata", 32d, CarType.Hybrid); GreenPlan customerInfo2 = new GreenPlan(2, 2010, "Honda", "Sonata", 32d, CarType.Hybrid); repoInfo.AddCarToList(customerInfo); repoInfo.AddCarToList(customerInfo2); repoInfo.RemoveCarFromList(customerInfo); List <GreenPlan> list = repoInfo.GetAllCarInfo(); var expected = 1; var actual = list.Count; Assert.AreEqual(expected, actual); }
public void RemoveCarFromList() { Console.Clear(); List <Car> list = _greenRepo.SeeAllCarsOnList(); // And here you're doing the same thing //But then you have this foreach that lists the vehicles foreach (Car item in list) { Console.WriteLine($"{item.CarType} {item.Make} {item.Model} {item.YearofCar} {item.NumberofDoors} {item.CarID} "); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Console.WriteLine("What is the the Car ID number that you would like to remove?"); int CarID = ParseInput(); Console.ReadLine(); _greenRepo.RemoveCarFromList(CarID); Console.WriteLine("Press any key to continue"); Console.ReadKey(); }