public void RemoveVehicleTest() { VehiclesManager repository = new VehiclesManager(); var expectedVehicle = new Car { Make = "Ford", Model = "Mustang", ProductionYear = 2000, LicensePlate = "NY2000", }; repository.AddVehicle(expectedVehicle); CollectionAssert.Contains(repository.Vehicles, expectedVehicle); repository.RemoveVehicle(expectedVehicle.LicensePlate); CollectionAssert.DoesNotContain(repository.Vehicles, expectedVehicle); }
public void FindVehicleByLicecnsePlateTest() { VehiclesManager repository = new VehiclesManager(); var expectedVehicle = new Car { Make = "Ford", Model = "Mustang", ProductionYear = 2000, LicensePlate = "NY2000", }; repository.AddVehicle(expectedVehicle); Assert.IsNotNull(repository.FindVehicleByLicecnsePlate(expectedVehicle.LicensePlate), "Vehicle not found"); }
public void SaveLoadTest() { VehiclesManager repository = new VehiclesManager(); var expectedVehicle = new Car { Make = "Ford", Model = "Mustang", ProductionYear = 2000, LicensePlate = "NY2000", }; repository.AddVehicle(expectedVehicle); var tempFile = Path.GetTempFileName(); repository.SaveVehicles(tempFile); VehiclesManager repository2 = new VehiclesManager(); repository2.LoadVehicles(tempFile); Assert.IsNotNull(repository2.Vehicles.FirstOrDefault(i => i.CompareTo(expectedVehicle) == 0), "Vehicle not found"); }
public void TestRemoveVehicle() { VehiclesManager repository = new VehiclesManager(); var vehicle = new Car { Make = "Ford", Model = "Mustang", ProductionYear = 2000, LicensePlate = "NY2000", }; repository.AddVehicle(vehicle); CollectionAssert.Contains(repository.Vehicles, vehicle); var context = new CommandContext() { VehiclesManager = repository, LicensePlateInput = () => vehicle.LicensePlate, Command = Command.RemoveVehicle }; CommandProcesseor commandProcesseor = new CommandProcesseor(); commandProcesseor.ProcessUserSelection(context); CollectionAssert.DoesNotContain(repository.Vehicles, vehicle); }