public static void AddNewCustomers(int count) { DefaultCustomerList = new List <Customer>(); for (var i = 0; i < count; i++) { var newCustomer = new Customer(Cm.MakeCar()); newCustomer.Say($"{newCustomer.Name}: I heard this is a great place to repair my car. I might consider coming soon..."); CustomerQueue <Customer> .Enqueue(newCustomer, DefaultCustomerList); } }
public void BuildCheapCarTest() { var maker = new CarMaker(new CheapCarBuilder()); maker.MakeCar(); var car = maker.GetCar(); Assert.Equal("Trabant", car.Brand); Assert.Equal(DoorType.Normal, car.Door); Assert.Equal(120d, car.MaxSpeed); Assert.Equal(EngineType.Benzin, car.Engine); Assert.Equal(3, car.NumberOfDoors); Assert.Equal(WheelType.Aluminium, car.Wheels); }
public void BuildSportsCarTest() { var maker = new CarMaker(new SportsCarBuilder()); maker.MakeCar(); var car = maker.GetCar(); Assert.Equal("Lotus", car.Brand); Assert.Equal(DoorType.Scissor, car.Door); Assert.Equal(240d, car.MaxSpeed); Assert.Equal(EngineType.Electric, car.Engine); Assert.Equal(2, car.NumberOfDoors); Assert.Equal(WheelType.Alloy, car.Wheels); }
static void CreateFordCars() { FordCar fordCar = new FordCar(); fordCar.Name = "Ford Car Prototype"; fordCar.Make = "FUSION"; CarMaker carMaker = new CarMaker(fordCar); List <FordCar> fordCars = new List <FordCar>(); for (int i = 0; i < 5; i++) { FordCar newFordCar = (FordCar)carMaker.MakeCar(); newFordCar.Name = newFordCar.Name.Replace("Prototype", $"No.{i + 1}"); fordCars.Add(newFordCar); } foreach (var car in fordCars) { Console.WriteLine($"Made {car.Name} with ID = {car.ID}"); } }