public void GetUsagePerMeter_good()
    {
        var car = RemoteControlCar.Buy();

        car.Drive(); car.Drive();
        var tc = new TelemetryClient(car);

        Assert.Equal("usage-per-meter=5", tc.GetBatteryUsagePerMeter(serialNum: 1));
    }
示例#2
0
    public void DisplayNextSponsor_for_3_sponsors()
    {
        var car = RemoteControlCar.Buy();

        car.SetSponsors("Exercism", "Walker Industries", "Acme Co.");
        var sp1 = car.DisplaySponsor(sponsorNum: 0);
        var sp2 = car.DisplaySponsor(sponsorNum: 1);
        var sp3 = car.DisplaySponsor(sponsorNum: 2);

        Assert.Equal((sp1, sp2, sp3), ("Exercism", "Walker Industries", "Acme Co."));
    }
示例#3
0
    public void GetTelmetryData_good()
    {
        var car = RemoteControlCar.Buy();

        car.Drive();
        car.Drive();
        int serialNum = 1;

        car.GetTelemetryData(ref serialNum, out int batteryPercentage, out int distanceDrivenInMeters);
        Assert.Equal((1, 80, 4), (serialNum, batteryPercentage, distanceDrivenInMeters));
    }
    public void GetTelmetryData_bad()
    {
        var car = RemoteControlCar.Buy();
        int batteryPercentage, distanceDrivenInMeters;

        car.Drive();
        car.Drive();
        int serialNum = 4;

        car.GetTelemetryData(ref serialNum, out batteryPercentage, out distanceDrivenInMeters);
        serialNum = 1;
        bool result = car.GetTelemetryData(ref serialNum, out batteryPercentage, out distanceDrivenInMeters);

        Assert.False(result);
        Assert.Equal((4, -1, -1), (serialNum, batteryPercentage, distanceDrivenInMeters));
    }
示例#5
0
    public void Buy_new_car_returns_instance()
    {
        var car = RemoteControlCar.Buy();

        Assert.NotNull(car);
    }
示例#6
0
文件: ClassesTests.cs 项目: sgedye/v3
    public void BuyNewCarReturnsInstance()
    {
        var car = RemoteControlCar.Buy();

        Assert.NotNull(car);
    }