public async Task GetRecipePriceBreakdown_NotFound2() { RecipeRepository recipe = new RecipeRepository(_options, new HttpClient(), _cacheServiceMock.Object); var controller = new RecipesController(recipe, _mapper, _logger); var result = await controller.GetRecipePriceBreakdown(0); result.Should().NotBeNull(); var notFoundResult = result.Should().BeOfType <NotFoundResult>().Subject; Assert.True(notFoundResult.StatusCode.Equals(404)); }
public async Task GetRecipePriceBreakdown_OkResult() { RecipeRepository recipe = new RecipeRepository(_options, new HttpClient(), _cacheServiceMock.Object); var controller = new RecipesController(recipe, _mapper, _logger); var result = await controller.GetRecipePriceBreakdown(12); result.Should().NotBeNull(); var okResult = result.Should().BeOfType <OkObjectResult>().Subject; Assert.True(okResult.StatusCode.Equals(200)); var model = okResult.Value.Should().BeAssignableTo <RecipesPriceBreakdownResponse>().Subject; model.TotalCost.Should().Be(new Decimal(700.7)); model.TotalCostPerServing.Should().Be(new Decimal(58.39)); model.Ingredients.Should().HaveCount(3); }