public IActionResult Delete(int id) { try { repo.DeleteCar(id); return(Ok()); } catch (Exception e) { return(StatusCode(500, e)); } }
public void DeleteCar_Test() { //Arrange CarsRepository repo = new CarsRepository(); Car car = new Car { Id = 2, Make = "Murano", Model = "SL", Year = 2014, Manufacturer = "Nissan" }; //Act var deleted = repo.DeleteCar(car.Id); //Assert Assert.IsTrue(deleted); }
private void DeleteCar(CarsRepository repository, long carId) { repository.DeleteCar(carId); }