public void Super_hungry_car_can_try_driving_but_is_drained() { int speed = 100; int batteryDrain = 60; var car = new RemoteControlCar(speed, batteryDrain); car.Drive(); car.Drive(); Assert.True(car.BatteryDrained()); Assert.Equal(100, car.DistanceDriven()); }
public void DriveDoesNotIncreaseDistanceDrivenWhenBatteryDrained() { int speed = 9; int batteryDrain = 50; var car = new RemoteControlCar(speed, batteryDrain); // Drain the battery car.Drive(); car.Drive(); // One extra drive attempt (should not succeed) car.Drive(); Assert.Equal(18, car.DistanceDriven()); }
public void Distance_display_when_battery_empty() { var car = new RemoteControlCar(); // Drain the battery for (var i = 0; i < 100; i++) { car.Drive(); } // Attempt to drive one more time (should not work) car.Drive(); Assert.Equal("Driven 2000 meters", car.DistanceDisplay()); }
public void BatteryDisplayWhenBatteryEmpty() { var car = new RemoteControlCar(); // Drain the battery for (var i = 0; i < 100; i++) { car.Drive(); } // Attempt to drive one more time (should not work) car.Drive(); Assert.Equal("Battery empty", car.BatteryDisplay()); }
public void Battery_display_after_driving_once() { var car = new RemoteControlCar(); car.Drive(); Assert.Equal("Battery at 99%", car.BatteryDisplay()); }
public void Distance_display_after_driving_once() { var car = new RemoteControlCar(); car.Drive(); Assert.Equal("Driven 20 meters", car.DistanceDisplay()); }
public bool TryFinishTrack(RemoteControlCar car) { while (CanContinueDriving(car)) { car.Drive(); } return(DidCarFinishTrack(car)); }
public bool CarCanFinish(RemoteControlCar car) { while (!car.BatteryDrained()) { car.Drive(); } return(car.DistanceDriven() >= distance); }
public void Super_hungry_car_after_one_drive_is_drained() { int speed = 100; int batteryDrain = 60; var car = new RemoteControlCar(speed, batteryDrain); car.Drive(); Assert.True(car.BatteryDrained()); }
public bool TryFinishTrack(RemoteControlCar car) { while (!car.BatteryDrained() && car.DistanceDriven() < distance) { car.Drive(); } return(car.DistanceDriven() >= distance); }
public void DriveIncreasesDistanceDrivenWithSpeed() { int speed = 5; int batteryDrain = 1; var car = new RemoteControlCar(speed, batteryDrain); car.Drive(); Assert.Equal(5, car.DistanceDriven()); }
public void Battery_display_after_driving_multiple_times() { var car = new RemoteControlCar(); for (var i = 0; i < 23; i++) { car.Drive(); } Assert.Equal("Battery at 77%", car.BatteryDisplay()); }
public void Distance_display_after_driving_multiple_times() { var car = new RemoteControlCar(); for (var i = 0; i < 17; i++) { car.Drive(); } Assert.Equal("Driven 340 meters", car.DistanceDisplay()); }
public bool CarCanFinish(RemoteControlCar car) { while (car.DistanceDriven() < Distance) { if (car.BatteryDrained()) { return(false); } car.Drive(); } return(true); }
public void DriveUntilBatteryIsDrained() { int speed = 2; int batteryDrain = 1; var car = new RemoteControlCar(speed, batteryDrain); // Drain the battery for (var i = 0; i < 100; i++) { car.Drive(); } Assert.True(car.BatteryDrained()); }
public void DriveToAlmostDrainBattery() { int speed = 2; int batteryDrain = 1; var car = new RemoteControlCar(speed, batteryDrain); // Almost drain the battery for (var i = 0; i < 99; i++) { car.Drive(); } Assert.False(car.BatteryDrained()); }