Пример #1
0
        static void Main(string[] args)
        {
            var bike = new MotorBike(new GasEngine(100));

            bike.RunAtHalfSpeed();

            bike = new MotorBike(new DieselEngine(30));
            bike.RunAtHalfSpeed();
        }
Пример #2
0
        public void ElectricEngine_Set_Get(uint a)
        {
            ElectricEngine _suut = new ElectricEngine(a);
            MotorBike      _uut  = new MotorBike(_suut);

            Assert.That(_suut.CurThrottle = a, Is.EqualTo(a));
            _uut.RunAtHalfSpeed();
            Assert.That(_suut.CurThrottle, Is.EqualTo(a / 2));
        }
Пример #3
0
        static void Main(string[] args)
        {
            MotorBike myBike = new MotorBike(new GasEngine(100));

            myBike.SetSpeed(90);
            Console.WriteLine("Current speed is: " + myBike.CurrentSpeed().ToString());
            myBike.RunAtHalfSpeed();
            Console.WriteLine("Current speed is: " + myBike.CurrentSpeed().ToString());
            Console.ReadLine();
        }
Пример #4
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("::::::::GasEngine::::::::");
            IEngine myGasEngine = new GasEngine(10);
            MotorBike myGasBike = new MotorBike(myGasEngine);
            System.Console.WriteLine("Run at half speed.");
            myGasBike.RunAtHalfSpeed();

            System.Console.WriteLine("::::::::DieselEngine:::::");
            IEngine myDieEngine = new DieselEngine(20);
            MotorBike myDieselBike = new MotorBike(myDieEngine);
            System.Console.WriteLine("Run at half speed.");
            myDieselBike.RunAtHalfSpeed();
        }
Пример #5
0
        static void Main(string[] args)
        {
            // ************************************** //
            // *** Gas engine and gas-driven bike *** //
            // ************************************** //
            var myGasEngine    = new GasEngine(100);
            var myGasMotorBike = new MotorBike(myGasEngine);
            var thr            = myGasEngine.CurThrottle;

            Console.WriteLine($"My gas throttle when idling is: {thr}.");
            thr = myGasEngine.MaxThrottle;
            Console.WriteLine($"My gas throttle at full speed is: {thr}");
            myGasMotorBike.RunAtHalfSpeed();
            thr = myGasEngine.CurThrottle;
            Console.WriteLine($"My gas throttle at half speed is: {thr}");

            // ******************************************** //
            // *** Diesel engine and diesel-driven bike *** //
            // ******************************************** //
            var myDieselEngine    = new DieselEngine(120);
            var myDieselMotorBike = new MotorBike(myDieselEngine);
            // Diesel-bike outputs:
            var thr2 = myDieselEngine.CurThrottle;

            Console.WriteLine($"My diesel throttle when idling is: {thr2}");
            thr2 = myDieselEngine.MaxThrottle;
            Console.WriteLine($"My diesel throttle at full speed is: {thr2}");
            myDieselMotorBike.RunAtHalfSpeed();
            thr2 = myDieselEngine.CurThrottle;
            Console.WriteLine($"My diesel throttle at half speed is: {thr2}");

            // ************************************************ //
            // *** Electric engine and electric-driven bike *** //
            // ************************************************ //
            var myElectricEngine    = new ElectricEngine(168);
            var myElectricMotorBike = new MotorBike(myElectricEngine);
            // Electric-bike outputs:
            var thr3 = myElectricEngine.CurThrottle;

            Console.WriteLine($"My electric throttle when idling is: {thr3}");
            thr3 = myElectricEngine.MaxThrottle;
            Console.WriteLine($"My electric throttle at full speed is: {thr3}");
            myElectricMotorBike.RunAtHalfSpeed();
            thr3 = myElectricEngine.CurThrottle;
            Console.WriteLine($"My electric throttle at half speed is: {thr3}");

            Console.ReadLine();
        }
Пример #6
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("::::::::GasEngine::::::::");
            IEngine   myGasEngine = new GasEngine(10);
            MotorBike myGasBike   = new MotorBike(myGasEngine);

            System.Console.WriteLine("Run at half speed.");
            myGasBike.RunAtHalfSpeed();

            System.Console.WriteLine("::::::::DieselEngine:::::");
            IEngine   myDieEngine  = new DieselEngine(20);
            MotorBike myDieselBike = new MotorBike(myDieEngine);

            System.Console.WriteLine("Run at half speed.");
            myDieselBike.RunAtHalfSpeed();
        }