public void CreateCar() { Console.WriteLine("Enter car name: "); string carName = Console.ReadLine(); Console.WriteLine("Enter car type: \n" + "1. Electric\n" + "2. Hybrid\n" + "3. Gas\n"); string typeAsString = Console.ReadLine(); int typeInt = int.Parse(typeAsString); CarType type = (CarType)typeInt; Console.WriteLine("Enter car engine: "); string carEngine = Console.ReadLine(); Console.WriteLine("Enter gas mileage: "); string gasMileage = Console.ReadLine(); Console.WriteLine("Enter driving type: "); string drivingType = Console.ReadLine(); CarContent content = new CarContent(carName, type, carEngine, gasMileage, drivingType); _carRepo.AddToList(content); }
public void AddToListTest() { CarRepository carRepo = new CarRepository(); List <CarContent> content = carRepo.GetCarList(); CarContent contentTwo = new CarContent("Buick", CarType.Gas, "V6", "30mpg", "Front Wheel"); int expected = 1; carRepo.AddToList(contentTwo); Assert.AreEqual(expected, content.Count); }