Beispiel #1
0
        //Aбстрактна фабрика - Abstract Factory
        public Run AbstractFactory()
        {
            Console.WriteLine("Abstract Factory:");

            // Abstract factory #1
            Patterns.Creational.AbstractFactory.AbstractFactory factory1 = new ConcreteFactory1();
            Client c1 = new Client(factory1);
            c1.Run();

            // Abstract factory #2
            Patterns.Creational.AbstractFactory.AbstractFactory factory2 = new ConcreteFactory2();
            Client c2 = new Client(factory2);
            c2.Run();

            return this;
        }
 public void ConcreteFactory1CreatesProductA1()
 {
     AbstractFactory factory = new ConcreteFactory1();
       AbstractProductA productA = factory.CreateProductA();
       Assert.IsType(typeof(ProductA1), productA);
 }