示例#1
0
        public void CarController_SetGear_CallsCarsSetGearMethod()
        {
            //arrange
            AbstractCar   car           = new MockCar();
            CarController carController = new(car);

            //act
            var result = carController.SetGear(Gear.First);

            //assert

            Assert.True(result == true, "SetGear failed to call cars set gear method.");
            Assert.True(car.Gear == Gear.First, "SetGear failed to set cars gear.");
        }
示例#2
0
        public void CarController_SetSpeed_CallsCarsTurnOffEngineM1ethod()
        {
            //arrange
            AbstractCar   car           = new MockCar();
            CarController carController = new(car);

            //act
            var result = carController.SetSpeed(10);

            //assert

            Assert.True(result == true, "SetSpeed failed to call cars set speed.");
            Assert.True(car.Speed == 10, "SetSpeed failed to set cars speed.");
        }
示例#3
0
        public void CarController_EngineOff_CallsCarsTurnOffEngineMethod()
        {
            //arrange
            AbstractCar   car           = new MockCar();
            CarController carController = new(car);

            //act
            var result = carController.EngineOff();

            //assert

            Assert.True(result == true, "EngineOff failed to call cars engine off.");
            Assert.True(car.IsEngineRunning == false, "EngineOff failed to call cars engine off.");
        }