public void Buy_new_car_returns_new_car_each_time() { var car1 = RemoteControlCar.Buy(); var car2 = RemoteControlCar.Buy(); Assert.NotSame(car2, car1); }
public void GetUsagePerMeter_not_started() { var car = RemoteControlCar.Buy(); var tc = new TelemetryClient(car); Assert.Equal("no data", tc.GetBatteryUsagePerMeter(serialNum: 1)); }
public void Top_of_the_line_car_has_correct_speed() { var car = RemoteControlCar.TopOfTheLine(); car.Drive(); Assert.Equal(50, car.DistanceDriven()); }
public void Nitro_car_has_correct_speed() { var car = RemoteControlCar.Nitro(); car.Drive(); Assert.Equal(50, car.DistanceDriven()); }
public void Battery_display_after_driving_once() { var car = new RemoteControlCar(); car.Drive(); Assert.Equal("Battery at 99%", car.BatteryDisplay()); }
public void TopOfTheLineCarHasCorrectSpeed() { var car = RemoteControlCar.TopOfTheLine(); car.Drive(); Assert.Equal(50, car.DistanceDriven()); }
public void BuyNewCarReturnsNewCarEachTime() { var car1 = RemoteControlCar.Buy(); var car2 = RemoteControlCar.Buy(); Assert.NotSame(car2, car1); }
public void Distance_display_after_driving_once() { var car = new RemoteControlCar(); car.Drive(); Assert.Equal("Driven 20 meters", car.DistanceDisplay()); }
public void ShowSponsor() { var car = new RemoteControlCar(); string expected = "Walker Industries Inc."; car.Telemetry.ShowSponsor(expected); Assert.Equal(expected, car.CurrentSponsor); }
public void ShowSpeed() { var car = new RemoteControlCar(); string expected = "100 meters per second"; car.Telemetry.SetSpeed(100, "mps"); Assert.Equal(expected, car.GetSpeed()); }
public bool TryFinishTrack(RemoteControlCar car) { while (CanContinueDriving(car)) { car.Drive(); } return(DidCarFinishTrack(car)); }
public void NewRemoteControlCarBatteryIsNotDrained() { int speed = 15; int batteryDrain = 3; var car = new RemoteControlCar(speed, batteryDrain); Assert.False(car.BatteryDrained()); }
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()); }
public void NewRemoteControlCarHasNotDrivenAnyDistance() { int speed = 10; int batteryDrain = 2; var car = new RemoteControlCar(speed, batteryDrain); Assert.Equal(0, car.DistanceDriven()); }
public void New_remote_control_car_has_not_driven_any_distance() { int speed = 10; int batteryDrain = 2; var car = new RemoteControlCar(speed, batteryDrain); Assert.Equal(0, car.DistanceDriven()); }
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 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)); }
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 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 Car_can_finish_with_car_that_can_just_finish() { int speed = 2; int batteryDrain = 10; var car = new RemoteControlCar(speed, batteryDrain); int distance = 20; var race = new RaceTrack(distance); Assert.True(race.TryFinishTrack(car)); }
public void Car_can_finish_with_car_that_can_easily_finish() { int speed = 10; int batteryDrain = 2; var car = new RemoteControlCar(speed, batteryDrain); int distance = 100; var race = new RaceTrack(distance); Assert.True(race.CarCanFinish(car)); }
public void CarCanFinishWithCarThatCannotFinish() { int speed = 1; int batteryDrain = 20; var car = new RemoteControlCar(speed, batteryDrain); int distance = 678; var race = new RaceTrack(distance); Assert.False(race.CarCanFinish(car)); }
public void CarCanFinishWithCarThatCanJustFinish() { int speed = 2; int batteryDrain = 10; var car = new RemoteControlCar(speed, batteryDrain); int distance = 20; var race = new RaceTrack(distance); Assert.True(race.CarCanFinish(car)); }
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 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.")); }
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 Car_can_finish_with_car_that_just_cannot_finish() { int speed = 3; int batteryDrain = 20; var car = new RemoteControlCar(speed, batteryDrain); int distance = 16; var race = new RaceTrack(distance); Assert.False(race.CarCanFinish(car)); }