static void Main(string[] args) { IAutoFactories bmwfactory = new BMWFactory(); IAutoFactories MiniCooperFactory = new MiniCooperFactory(); LoadFactory(bmwfactory); LoadFactory(MiniCooperFactory); }
public void CreateEngineForBMW() { var factory = new BMWFactory(); var engine = factory.CreatEngine(); engine.Name.Should().BeEquivalentTo("двигатель от BMW"); }
private static void Case1() { IAutoFactory Factory = BMWFactory.GetInstance(); IAutomobile auto = Factory.Make(); auto.start(); auto.stop(); Console.WriteLine(Factory); }
static void executeSimpleFactory() { IAutoFactory autoFactory = new BMWFactory(); IAuto car = autoFactory.CreateAutomobile(); car.TurnOn(); car.TurnOff(); Console.ReadKey(); }
public static void CarFactoryExample() { var bmwFactory = new BMWFactory(); PrintCarCharacteristics(bmwFactory); var audiFactory = new AudiFactory(); PrintCarCharacteristics(audiFactory); }
public void CreateBMWSportCar(BMWFactory sut) { var auto = sut.CreateSportCar(); var actual = Assert.IsAssignableFrom <IAutomobile>(auto); const string expected = "BMW M3"; Assert.Equal(expected, actual.TurnOn()); }
public void A_BMWFactory_Should_Return_A_BMW_Instance() { //Arrange AutoFactory autoFactory = new BMWFactory(); //Act var expectedInstance = autoFactory.CreateAutoMobile(); var expectedType = typeof(BMW).FullName; var instanceType = expectedInstance.GetType().FullName; //Assert Assert.Equal(expectedType, instanceType); }
public void A_Factory_Should_Return_A_EconomyCar_Instance() { //Arrange IAutoFactory autoFactory = new BMWFactory(); //Act var expectedInstance = autoFactory.CreateEconomyCar(); var expectedType = typeof(BMW328i).FullName; var instanceType = expectedInstance.GetType().FullName; //Assert Assert.Equal(expectedType, instanceType); }
static void Main(string[] args) { // Абстрактная фабрика № 1 CarFactory bmw_car = new BMWFactory(); var c1 = new Client(bmw_car); c1.Run(); // Абстрактная фабрика № 2 CarFactory audi_factory = new AudiFactory(); var c2 = new Client(audi_factory); c2.Run(); Console.Read(); }
private static void Case1() { IAutoMobileFactory factory = BMWFactory.GetInstance(); IAutoMobile autoMobile = factory.Make(); autoMobile.Start(); autoMobile.Stop(); IAutoMobileFactory factory1 = AudiFactory.GetInstance(); IAutoMobile autoMobile1 = factory1.Make(); autoMobile1.Start(); autoMobile1.Stop(); IAutoMobileFactory factory2 = TeslaFactory.GetInstance(); IAutoMobile autoMobile2 = factory2.Make(); autoMobile2.Start(); autoMobile2.Stop(); }
static void Main(string[] args) { // Simple Factory Console.WriteLine("Simple Factory"); Console.WriteLine(); CarFactory simpleFactory = new CarFactory(); ICar simpleCar = simpleFactory.GetCar("bmw"); Console.WriteLine("Setting car model in client."); simpleCar.SetModel("i8"); Console.Read(); // Factory Method Console.WriteLine("Factory Method"); Console.WriteLine(); ICarFactory factoryMethodBMW = new BMWFactory(); factoryMethodBMW.GetCar(); ICarFactory factoryMethodAudi = new AudiFactory(); Console.WriteLine("Setting Audi model in client."); simpleCar.SetModel("TT"); Console.Read(); }
public Order(BMWFactory factory) { window = factory.CreateWindow(); body = factory.CreateBody(); }