コード例 #1
0
        public IMotorbike OrderMotorbike(MotorbikeTypes type)
        {
            Logger.Write($"Order placed for {type} motorbike.");

            var motorbike = _factory.CreateMotorbike(type);

            motorbike.PerformValet();
            motorbike.PerformService();
            motorbike.AddFuel();

            Logger.Write($"Order completed with motorbike: {motorbike.ToString()}");

            return(motorbike);
        }
コード例 #2
0
        public IMotorbike CreateMotorbike(MotorbikeTypes type)
        {
            Motorbike motorbike;

            // Italians like yellow motorbikes right?
            switch (type)
            {
            case MotorbikeTypes.Chopper:
                motorbike = new Motorbike(MotorbikeTypes.Chopper, 400, Colours.Yellow, 0, 1);
                break;

            case MotorbikeTypes.Scooter:
                motorbike = new Motorbike(MotorbikeTypes.Scooter, 60, Colours.Yellow, 0, 1);
                break;

            default:
                motorbike = new Motorbike(MotorbikeTypes.Tourer, 1000, Colours.Yellow, 0, 1);
                break;
            }

            // Who needs safety checks?

            return(motorbike);
        }
コード例 #3
0
        public IMotorbike CreateMotorbike(MotorbikeTypes type)
        {
            Motorbike motorbike;

            switch (type)
            {
            case MotorbikeTypes.Chopper:
                motorbike = new Motorbike(MotorbikeTypes.Chopper, 400, Colours.Black, 0, 1);
                break;

            case MotorbikeTypes.Scooter:
                motorbike = new Motorbike(MotorbikeTypes.Scooter, 60, Colours.Yellow, 0, 1);
                break;

            default:
                motorbike = new Motorbike(MotorbikeTypes.Tourer, 1000, Colours.Red, 0, 1);
                break;
            }

            PerformSafetyChecks(motorbike);
            PerformCrashTests(motorbike);

            return(motorbike);
        }
コード例 #4
0
 public Motorbike(MotorbikeTypes type, int engineSize, Colours colour, int doors, int seats) : base(engineSize, colour, doors, seats)
 {
     this.Type = type;
 }