private void ShowAllCars() { Console.WriteLine("Which type of cars would you like to see?\n" + "1: Electric\n" + "2: Hybrid\n" + "3: Gas"); int cType = int.Parse(Console.ReadLine()); CarType carType = (CarType)cType; foreach (GreenPlan crud in _carRepo.GetAllCarInfoType(carType)) { Console.WriteLine($"{crud.CarID} {crud.YearOfCar} {crud.MakeOfCar} {crud.ModelOfCar} {crud.GasMileage} {crud.CarType}"); } }
public void GetListByType() { 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); List <GreenPlan> list = repoInfo.GetAllCarInfoType(CarType.Hybrid); var expected = 2; var actual = list.Count; Assert.AreEqual(expected, actual); }