예제 #1
0
        public void WillCreateSuv()
        {
            var shop = new CarShop();

            var car = shop.CreateCar(new SuvCarBuilder());

            Assert.That(car.HasAwd, Is.True);
            Assert.That(car.MaxSpeed, Is.EqualTo(190));
        }
예제 #2
0
        public void WillCreateHatchback()
        {
            var shop = new CarShop();

            var car = shop.CreateCar(new HatchbackCarBuilder());

            Assert.That(car.HasAwd, Is.False);
            Assert.That(car.MaxSpeed, Is.EqualTo(205));
        }
예제 #3
0
        static void Main(string[] args)
        {
            CarShop carshop = new CarShop();
            CarBuilder carbuilder;

            carbuilder = new ConvertibleBuilder();
            carshop.BuildCar(carbuilder);
            carbuilder.Car.DisplayCar();

            carbuilder = new CoupeBuilder();
            carshop.BuildCar(carbuilder);
            carbuilder.Car.DisplayCar();

            carbuilder = new SedanBuilder();
            carshop.BuildCar(carbuilder);
            carbuilder.Car.DisplayCar();

            carbuilder = new SUVBuilder();
            carshop.BuildCar(carbuilder);
            carbuilder.Car.DisplayCar();

            carbuilder = new TruckBuilder();
            carshop.BuildCar(carbuilder);
            carbuilder.Car.DisplayCar();

            Console.ReadKey();
        }