public async Task BuyProductPost_ReturnsBadRequestResult_WhenModelStateIsInvalid() { _controller.ModelState.AddModelError("TypeProduct", "Required"); var param = new CreatorProductDTO(); // Act var response = await _controller.BuyProduct(param); // Assert var actionResult = Assert.IsType <ActionResult <ProductDTO> >(response); Assert.IsType <BadRequestObjectResult>(actionResult.Result); }