public void Should_Return_True_When_Update_Car_Success() { Mock <Car> car = new Mock <Car>(); // assume repository return true CarRepository.Setup(a => a.UpdateCarData(car.Object)) .Returns(true); var result = CarService.UpdateCar(car.Object); Assert.IsTrue(result); }
public ActionResult UpdateCar([FromBody] Car car) { var success = _carService.UpdateCar(car); if (success) { return(Ok(car)); } return(BadRequest()); }