public async Task DeleteCustomerVehicle(Guid vehicleId, Guid customerId, Guid clientId) { var vehicle = await repo.FindById(vehicleId, clientId); if (vehicle == null) { throw new Exception("Cannot delete as vehicle cannot be found"); } await repo.Delete(vehicleId, clientId); }
public async Task UpdateVehicleMotData_Should_ReturnUpdatedAfterFetch() { // Arrange var currentExpiryDate = DateTime.Parse("2019-01-01"); var dummyVehicle = new CustomerVehicle { CustomerId = Guid.NewGuid(), ClientId = Guid.NewGuid(), Registration = "LD66OFZ", MotData = new MotData { MOTExpiryDate = currentExpiryDate } }; await repo.Create(dummyVehicle, dummyVehicle.CustomerId, dummyVehicle.ClientId); var sut = new CustomerVehicleService(repo, new MockVehicleDataService()); await sut.UpdateMotData(dummyVehicle.Id, dummyVehicle.ClientId); // Act var result = await repo.FindById(dummyVehicle.Id, dummyVehicle.ClientId); // Assert Assert.True(result.MotData.MOTExpiryDate > currentExpiryDate); }