Esempio n. 1
0
    public void NewRemoteControlCarBatteryIsNotDrained()
    {
        int speed        = 15;
        int batteryDrain = 3;
        var car          = new RemoteControlCar(speed, batteryDrain);

        Assert.False(car.BatteryDrained());
    }
Esempio n. 2
0
    public void New_remote_control_car_battery_is_not_drained()
    {
        int speed        = 15;
        int batteryDrain = 3;
        var car          = new RemoteControlCar(speed, batteryDrain);

        Assert.False(car.BatteryDrained());
    }
Esempio n. 3
0
    public bool CarCanFinish(RemoteControlCar car)
    {
        while (!car.BatteryDrained())
        {
            car.Drive();
        }

        return(car.DistanceDriven() >= distance);
    }
Esempio n. 4
0
    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());
    }
Esempio n. 5
0
    public bool TryFinishTrack(RemoteControlCar car)
    {
        while (!car.BatteryDrained() && car.DistanceDriven() < distance)
        {
            car.Drive();
        }

        return(car.DistanceDriven() >= distance);
    }
Esempio n. 6
0
    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());
    }
Esempio n. 7
0
 public bool CarCanFinish(RemoteControlCar car)
 {
     while (car.DistanceDriven() < Distance)
     {
         if (car.BatteryDrained())
         {
             return(false);
         }
         car.Drive();
     }
     return(true);
 }
Esempio n. 8
0
    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());
    }
Esempio n. 9
0
    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());
    }
Esempio n. 10
0
 private bool CanContinueDriving(RemoteControlCar car) => car.DistanceDriven() < _distance && !car.BatteryDrained();