Example #1
0
        private static void BuildVolkswagenCar()
        {
            Console.WriteLine("-> Start Volkswagen car builder <-");

            var carMaker3 = new CarMaker(new VolkswagenCarBuilder());

            carMaker3.BuildCar();
            var car3 = carMaker3.GetCar();

            car3.Display();

            Console.WriteLine("-> Start Volkswagen car builder <-");
            Console.WriteLine();
        }
Example #2
0
        private static void BuildAudiCar()
        {
            Console.WriteLine("-> Start Audi car builder <-");

            var carMaker2 = new CarMaker(new AudiCarBuilder());

            carMaker2.BuildCar();
            var car2 = carMaker2.GetCar();

            car2.Display();

            Console.WriteLine("-> End Audi car builder <-");
            Console.WriteLine();
        }
Example #3
0
        private static void BuildBmwCar()
        {
            Console.WriteLine("-> Start BMW car builder <-");

            var carMaker = new CarMaker(new BmwCarBuilder());

            carMaker.BuildCar();
            var car1 = carMaker.GetCar();

            car1.Display();

            Console.WriteLine("-> End BMW car builder <-");
            Console.WriteLine();
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        private static void callBuilderPattern()
        {
            CarMaker carMaker = new CarMaker(new FordBuilder());

            carMaker.BuildCar();
            var car1 = carMaker.GetCar();

            car1.PrintCar();

            CarMaker carMaker2 = new CarMaker(new HundaiBuilder());

            carMaker2.BuildCar();
            var car2 = carMaker2.GetCar();

            car2.PrintCar();
        }