public void VacateCarTest() { Car[] cars = new Car[4] { new Car { Color = "white", RegistrationNumber = "KA-01-HH-1234", SlotNumber = 1 }, new Car { Color = "red", RegistrationNumber = "KA-01-HH-9876", SlotNumber = 2 }, new Car { Color = "blue", RegistrationNumber = "KA-01-KH-1762", SlotNumber = 3 }, new Car { Color = "brown", RegistrationNumber = "KA-01-ET-1111", SlotNumber = 4 } }; sampleLot = new Model.ParkingLot(4) { Cars = cars }; ICommands commands = new CommandRouter(); Program.ParkingLot = sampleLot; Assert.IsTrue(Program.ParkingLot.Cars[2] != null); commands.leave("3"); Assert.IsTrue(Program.ParkingLot.Cars[2] == null); }
public void VacateCar_NegTest() { Car[] cars = new Car[4] { new Car { Color = "white", RegistrationNumber = "KA-01-HH-1234", SlotNumber = 1 }, new Car { Color = "red", RegistrationNumber = "KA-01-HH-9876", SlotNumber = 2 }, new Car { Color = "blue", RegistrationNumber = "KA-01-KH-1762", SlotNumber = 3 }, new Car { Color = "brown", RegistrationNumber = "KA-01-ET-1111", SlotNumber = 4 } }; sampleLot = new Model.ParkingLot(4) { Cars = cars }; ICommands commands = new CommandRouter(); Program.ParkingLot = sampleLot; Assert.ThrowsException <BaseException>(() => commands.leave("10")).ErrorMessage.Equals(ErrorMessage.SlotDoesNotExist); }