public void Car_SetNegativeSpeed_ReturnsFalse() { //arrange Car car = CarFactory.GetCarWithTurnedOnEngine(); //act var result = car.SetSpeed(-10); //assert Assert.True(result == false && car.Speed == 0, "Succeeded to set negative speed."); }
public void Car_SetSpeedWithNeutralGearSetOn_ReturnsFalse() { //arrange Car car = CarFactory.GetCarWithTurnedOnEngine(); //act var result = car.SetSpeed(10); //assert Assert.True(result == false && car.Speed == 0, "Succeeded to set speed while gear was neutral."); }
public void Car_SetGearToReverseWhileMovingBackwardsOnNeutral_ReturnsFalse() { //arrange Car car = CarFactory.GetMovingBackwardsOnNeutralGearCarWithTenSpeed(); //act var result = car.SetGear(Gear.Reverse); //assert Assert.True(result == false, $"SetGear returns true when trying to set Reverse gear whlie moving backwards."); Assert.True(car.Gear == Gear.Neutral, $"Succeeded to set Reverse while moving backwards."); }
public void Car_SetGearToReverseWhileMovingForward_ReturnsFalse() { //arrange Car car = CarFactory.GetCarWithFirstGearAndTenSpeed(); //act var result = car.SetGear(Gear.Reverse); //assert Assert.True(result == false, $"SetGear returns true when trying to set Reverse gear whlie moving."); Assert.True(car.Gear == Gear.First, $"Succeeded to set Reverse while moving forward."); }
public void Car_SetGearFromNeutralWithIncorrectValue_ReturnsFalse(Gear gear) { //arrange Car car = CarFactory.GetCarWithTurnedOnEngine(); //act var result = car.SetGear(gear); //assert Assert.True(result == false, $"SetGear returns true when trying to set {gear} from Neutral."); Assert.True(car.Gear == Gear.Neutral, $"Succeeded to set {gear} from Neutral"); }
public void Car_SetGearFromNeutralWithCorrectValue_ReturnsTrue(Gear gear) { //arrange Car car = CarFactory.GetCarWithTurnedOnEngine(); //act var result = car.SetGear(gear); //assert Assert.True(result == true, $"SetGear returns false when trying to set {gear} from Neutral."); Assert.True(car.Gear == gear, $"Failed to set {gear} from Neutral"); }
public void Car_SetGearToFirstWithCorrectParams_ReturnsTrueAndSetsFirstGear() { //arrange Car car = CarFactory.GetCarWithTurnedOnEngine(); //act var result = car.SetGear(Gear.First); //assert Assert.True(result == true, "Failed to set first gear."); Assert.True(car.Gear == Gear.First, $"SetGear switched to {car.Gear} while trying to set First gear"); Assert.True(car.Direction == Direction.OnPlace, "SetGear changed direction."); }
public void Car_SetGearToFifthWithAllowedSpeed_ReturnsTrue() { //arrange Car car = CarFactory.GetCarWithFourthGearSet(); //act car.SetSpeed(50); var result = car.SetGear(Gear.Fifth); //assert Assert.True(result == true, $"SetGear returns false when trying to set Fifth gear with correct state."); Assert.True(car.Gear == Gear.Fifth, $"Failed to set Fifth with correct state."); }
public void Car_SetGearToThirdWithAllowedSpeed_ReturnsTrue() { //arrange Car car = CarFactory.GetCarWithSecondGearSet(); //act car.SetSpeed(30); var result = car.SetGear(Gear.Third); //assert Assert.True(result == true, $"SetGear returns false when trying to set Third gear with correct state."); Assert.True(car.Gear == Gear.Third, "Failed to set Third with correct state."); }
public void Car_TurnEngineOffWhenCarIsMoving_ReturnsFalse() { //arrange Car car = CarFactory.GetCarWithTurnedOnEngine(); //act car.SetGear(Gear.First); car.SetSpeed(10); var result = car.TurnOffEngine(); //assert Assert.True(result == false, "TurnOffEngine succeeded when car was moving."); Assert.True(car.IsEngineRunning == true, "TurnOffEngine turned car off when it was moving."); }