public void SaveRecipe_Success() { var result = _recipesController.SaveRecipe(CreateRandomRecipe()); result.Should().NotBeNull(); var res = (Microsoft.AspNetCore.Mvc.OkObjectResult)result; res.StatusCode.Should().Be((int)HttpStatusCode.OK); }
public void SaveRecipe_Failure() { var recipeResponse = new RecipeResponse("Null Category"); _mockService.Setup(s => s.SaveRecipe(It.IsAny <Recipe>())) .Returns(recipeResponse); _recipesController = new RecipesController(_mockService.Object, _logger.Object, _mappingConfig.CreateMapper()); var result = _recipesController.SaveRecipe(CreateRandomRecipe()); result.Should().NotBeNull(); var res = (Microsoft.AspNetCore.Mvc.BadRequestObjectResult)result; res.StatusCode.Should().Be((int)HttpStatusCode.BadRequest); }