public ActionResult DeleteCar(int id) { var success = _carService.DeleteCarById(id); if (success) { return(Ok()); } return(NotFound()); }
public void Should_Return_True_When_Delete_Exiting_Car() { //Mock Car Object with Id Property var car = AddCar(999); CarRepository.Setup(a => a.FindCarById(999)).Returns(car); CarRepository.Setup(a => a.DeleteCar(car)).Returns(true); var result = CarService.DeleteCarById(999); Assert.IsTrue(result); }