private async Task <int> GetStatusCodePatchOne(Mock <IGarmentPurchaseRequestItemFacade> mockFacade, Mock <IMapper> mockMapper, int id) { GarmentPurchaseRequestItemController controller = GetController(mockFacade, null, mockMapper); JsonPatchDocument <GarmentPurchaseRequestItem> patch = new JsonPatchDocument <GarmentPurchaseRequestItem>(); IActionResult response = await controller.PatchOne(patch, id); return(GetStatusCode(response)); }
public async Task PatchOne_BadRequest() { GarmentPurchaseRequestItemController controller = GetController(new Mock <IGarmentPurchaseRequestItemFacade>(), null, new Mock <IMapper>()); controller.ModelState.AddModelError("op", "Invalid op"); JsonPatchDocument <GarmentPurchaseRequestItem> patch = new JsonPatchDocument <GarmentPurchaseRequestItem>(); IActionResult response = await controller.PatchOne(patch, It.IsAny <int>()); int statusCode = GetStatusCode(response); Assert.Equal((int)HttpStatusCode.BadRequest, statusCode); }