public void Patch_When_model_is_not_valid_Then_return_status_code_400() { var service = A.Fake <IPilotService>(); A.CallTo(() => service.Update(1, 1)).Throws(new FluentValidation.ValidationException("")); var controller = new PilotsController(service); var result = controller.Patch(1, 1) as ObjectResult; Assert.AreEqual(400, result.StatusCode); }
public void Patch_When_opject_is_not_found_Then_return_status_code_404() { var service = A.Fake <IPilotService>(); A.CallTo(() => service.Update(1, 1)).Throws(new NotFoundException()); var controller = new PilotsController(service); var result = controller.Patch(1, 1) as ObjectResult; Assert.AreEqual(404, result.StatusCode); }
public void Patch_When_model_is_valid_Then_return_status_code_200() { var service = A.Fake <IPilotService>(); A.CallTo(() => service.Update(1, 1)); var controller = new PilotsController(service); var result = controller.Patch(1, 1) as ObjectResult; Assert.AreEqual(200, result.StatusCode); }