public async void PostMultipleClientCatalogsModelStateErrorReturnsBadRequest() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { controller.ModelState.AddModelError("an error", "some error"); IEnumerable <ClientCatalogDto> ClientCatalogList = Enumerable.Range(11, 10).Select(i => GetTestClientCatalogDto(i)); var result = await controller.PostMultipleClientCatalogs(ClientCatalogList); Assert.IsType <BadRequestObjectResult>(result); } }
public async void PostMultipleClientCatalogsCorrectDataCreatesClientCatalogs() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { IEnumerable <ClientCatalogDto> ClientCatalogList = Enumerable.Range(11, 10).Select(i => GetTestClientCatalogDto(i)); var result = await controller.PostMultipleClientCatalogs(ClientCatalogList); Assert.NotNull(result); Assert.IsType <CreatedAtActionResult>(result); } }