public async void DeleteClientCatalogWithIncorrectIdReturnsNotFound() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { var result = await controller.DeleteClientCatalog(99); Assert.IsType <NotFoundResult>(result); } }
public async void DeleteClientCatalogModelStateErrorReturnsBadRequest() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { controller.ModelState.AddModelError("an error", "some error"); var result = await controller.DeleteClientCatalog(1); Assert.IsType <BadRequestObjectResult>(result); } }
public async void DeleteClientCatalogIdDeletesClientCatalog() { using (var context = DbTestContext.GenerateContextWithData()) using (var controller = new ClientCatalogsController(context, _mapper)) { var result = await controller.DeleteClientCatalog(3); ClientCatalogDto p3 = GetTestClientCatalogDto(3); Assert.NotNull(result); var okObjectResult = Assert.IsType <OkObjectResult>(result); var resultValue = okObjectResult.Value; Assert.Equal(p3, resultValue); } }