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(); }
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(); }
public void Accelerate(GearShiftBoundaries gearShiftBoundaries) { var currentRpm = _externalSystems.GetCurrentRpm(); if (currentRpm < gearShiftBoundaries.DownshiftBoundary) { _gearShifter.Downshift(); } else if (currentRpm > gearShiftBoundaries.UpshiftBoundary * _rpmUpshiftFactor) { _gearShifter.Upshift(); } }
public void Accelerate(Threshold threshold) { var currentRpm = _externalSystems.GetCurrentRpm(); if (currentRpm > _gearShiftBoundaries.UpshiftBoundary) { _gearShifter.Upshift(); return; } if (currentRpm < _gearShiftBoundaries.DownshiftBoundary) { _gearShifter.Downshift(); } }