Пример #1
0
        public Vehicle Build(VehicleEnums.Brands brand, VehicleEnums.Colors color, int engineCapacity, int numberOfDoors, int numberOfSeats)
        {
            _carBuilder = new CarBuilder();

            return(_carBuilder
                   .WithBrand(brand)
                   .WithColor(color)
                   .WithEngineCapacity(engineCapacity)
                   .WithDoors(numberOfDoors)
                   .WithSeats(numberOfSeats)
                   .Build());
        }
        public Vehicle Build(VehicleEnums.Brands brand, VehicleEnums.Colors color, int engineCapacity, int numberOfDoors, int numberOfSeats, double freight)
        {
            _truckBuilder = new TruckBuilder();

            return(_truckBuilder
                   .WithBrand(brand)
                   .WithColor(color)
                   .WithEngineCapacity(engineCapacity)
                   .WithDoors(numberOfDoors)
                   .WithSeats(numberOfSeats)
                   .WithFreight(freight)
                   .Build());
        }
Пример #3
0
        public IEnumerable <Vehicle> Build(int count, VehicleEnums.Brands brand, VehicleEnums.Colors color, int engineCapacity, int numberOfDoors, int numberOfSeats)
        {
            for (int i = 0; i < count; i++)
            {
                _carBuilder = new CarBuilder();

                yield return(_carBuilder
                             .WithBrand(brand)
                             .WithColor(color)
                             .WithEngineCapacity(engineCapacity)
                             .WithDoors(numberOfDoors)
                             .WithSeats(numberOfSeats)
                             .Build());
            }
        }