コード例 #1
0
    public void Distance_display_after_driving_once()
    {
        var car = new RemoteControlCar();

        car.Drive();
        Assert.Equal("Driven 20 meters", car.DistanceDisplay());
    }
コード例 #2
0
    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());
    }
コード例 #3
0
    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());
    }
コード例 #4
0
    public void New_car_distance_display()
    {
        var car = new RemoteControlCar();

        Assert.Equal("Driven 0 meters", car.DistanceDisplay());
    }