Esempio n. 1
0
        public void MakeSport()
        {
            CarBuilder    carBuilder    = new CarBuilder();
            ManualBuilder manualBuilder = new ManualBuilder();
            Director      director      = new Director();

            director.makeSportCar(carBuilder);
            director.makeSportCar(manualBuilder);
            SportCar       = carBuilder.GetCar();
            SportCarManual = manualBuilder.GetManual();

            director.makeSimpleCar(carBuilder);
            director.makeSimpleCar(manualBuilder);
            SimpleCar       = carBuilder.GetCar();
            SimpleCarManual = manualBuilder.GetManual();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var director      = new Director();
            var builder       = new CarBuilder();
            var ManualBuilder = new ManualBuilder();

            director.Builder = builder;

            director.buildFullFeaturedProduct();
            Console.WriteLine(builder.GetProduct().ListParts());
            director.Builder = ManualBuilder;
            director.buildFullFeaturedProduct();
            Console.WriteLine(ManualBuilder.GetManual().ListManual());

            Console.ReadLine();
        }
Esempio n. 3
0
        public void BuildBus()
        {
            Director Director = new Director();

            // Construimos Bus
            CarBuilder carBuilder = new CarBuilder();

            Director.SetBuilder(carBuilder);
            Director.BuildBus();
            Car Car = carBuilder.GetCar();

            // Construimos el manual del Bus
            ManualBuilder manualBuilder = new ManualBuilder();

            Director.SetBuilder(manualBuilder);
            Director.BuildBus();
            Manual Manual = manualBuilder.GetManual();

            Assert.AreEqual(Car.Engine, "bus");
            Assert.AreEqual(Manual.EngineDescription, "Engine Description: bus");
        }