Ejemplo n.º 1
0
        public void Accelerate_ShouldDownshift_WhenCurrentRpmIsLesserThanDownshiftBoundary()
        {
            var currentRpm = new Rpm(800d);

            _externalSystems.GetCurrentRpm().Returns(currentRpm);

            var threshold = new Threshold(0.8d);

            Sut().Accelerate(threshold);

            _gearShifter.Received(1).Downshift();
            _gearShifter.DidNotReceive().Upshift();
        }
Ejemplo n.º 2
0
        public void Accelerate_ShouldDownshift_WhenCurrentRpmIsLesserThanDownshiftBoundary()
        {
            var currentRpm = new Rpm(1000d);

            _externalSystems.GetCurrentRpm().Returns(currentRpm);

            var shiftBoundaries = GetShiftBoundaries(1500d, 3000d);

            Sut().Accelerate(shiftBoundaries);

            _gearShifter.Received(1).Downshift();
            _gearShifter.DidNotReceive().Upshift();
        }
Ejemplo n.º 3
0
        public void Accelerate_ShouldCallAccelerateOnCurrectAggressiveMode_WhenNotKickdown()
        {
            var aggressiveMode = Substitute.For <IAggressiveMode>();

            _aggressiveModeFactory.Create().Returns(aggressiveMode);

            var threshold = new Threshold(0.4d);

            Sut().Accelerate(threshold);

            _gearShifter.DidNotReceive().Downshift();
            _gearShifter.DidNotReceive().Upshift();
            aggressiveMode.Received().Accelerate(_gearShiftBoundaries);
        }
Ejemplo n.º 4
0
        public void Accelerate_ShouldOnlyCallAccelerateOnBaseMode_WhenNotDrivingDown()
        {
            _externalSystems.IsDrivingDown().Returns(false);

            var threshold = new Threshold(0.8d);

            Sut().Accelerate(threshold);

            _gearShifter.DidNotReceive().Downshift();
            _baseMode.Received().Accelerate(threshold);
        }