public void ConstructAcerLaptop_ShouldReturnAnAcerLaptop()
        {
            var laptopFactory = new LaptopFactory();

            LaptopBuilder acerLaptopBuilder = laptopFactory.ConstructAcerLaptop();

            Assert.IsNotNull(acerLaptopBuilder);
            StringAssert.Contains(acerLaptopBuilder.ToString(), "Acer");
        }
        public void ConstructLenovoLaptop_ShouldReturnAnLenovoLaptop()
        {
            var laptopFactory = new LaptopFactory();

            LaptopBuilder lenovoLaptopBuilder = laptopFactory.ConstructLenovoLaptop();

            Assert.IsNotNull(lenovoLaptopBuilder);
            StringAssert.Contains(lenovoLaptopBuilder.ToString(), "Lenovo");
        }
Esempio n. 3
0
        public static void Main()
        {
            var laptopFactory = new LaptopFactory();

            var acerLaptop = laptopFactory.ConstructAcerLaptop();

            Console.WriteLine(acerLaptop);

            var lenovoLaptop = laptopFactory.ConstructLenovoLaptop();

            Console.WriteLine(lenovoLaptop);
        }
Esempio n. 4
0
        public void InitalizePattern()
        {
            GadgetFactory factory;

            factory = new TabletFactory();
            Gadget tablet = factory.Create();

            Console.WriteLine(tablet.ToString());

            factory = new LaptopFactory();
            Gadget laptop = factory.Create();

            Console.WriteLine(laptop.ToString());

            factory = new CellPhoneFactory();
            Gadget cellPhone = factory.Create();

            Console.WriteLine(cellPhone.ToString());

            Console.ReadLine();
        }