示例#1
0
        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));
        }
示例#2
0
        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);
        }