public async void PostClientCatalogModelStateErrorReturnsBadRequest() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { controller.ModelState.AddModelError("an error", "some error"); ClientCatalogDto p11 = GetTestClientCatalogDto(11); var result = await controller.PostClientCatalog(p11); Assert.IsType <BadRequestObjectResult>(result); } }
public async void PostClientCatalogCorrectDataCreatesClientCatalog() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { ClientCatalogDto p11 = GetTestClientCatalogDto(11); var result = await controller.PostClientCatalog(p11); Assert.NotNull(result); var resultValue = Assert.IsType <CreatedAtActionResult>(result); } }