private void ShiftUpGears(int gearShifts, GearBox gearBox) { gearBox.DoIt(0); //from neutral to first gear for (int i = 1; i < gearShifts; i++) { gearBox.DoIt(int.MaxValue); } }
public void ShiftFrom1To2WithSpecificRpm() { ShiftUpGears(1, _gearbox); var boundaryForGear1 = _rpmUpDictionary[1]; _gearbox.DoIt(boundaryForGear1 + 1); var resultAfterDoIt = _gearbox.S(); Assert.Equal(2, resultAfterDoIt); }
public void GearBoxCreatedWithoutDictionaryCanShiftUp() { var gearBox = new GearBox(); gearBox.DoIt(0); var result = gearBox.S(); Assert.Equal(1, result); }
private void ShiftsDownWithRpmLowerThanThreshold(IDictionary <int, int> downDictionary, int startingGear) { //arrange var upDictionary = DefaultUpDict(); var gearBox = new GearBox(upDictionary, downDictionary); ShiftUpGears(startingGear, gearBox); //action gearBox.DoIt(downDictionary[startingGear] - 1); var result = gearBox.S(); var expectedGear = startingGear - 1; Assert.Equal(expectedGear, result); }