public async Task NutrionVisualization_notFound() { var repository = new WidgetRepository(_options, new HttpClient()); var controller = new WidgetsController(repository, _mapper, _logger); var result = await controller.NutrionVisualization(-1); result.Should().NotBeNull(); var okResult = result.Should().BeOfType <NotFoundResult>().Subject; Assert.True(okResult.StatusCode.Equals(404)); }
public async Task NutrionVisualization_okResult() { var repository = new WidgetRepository(_options, new HttpClient()); var controller = new WidgetsController(repository, _mapper, _logger); var result = await controller.NutrionVisualization(12); result.Should().NotBeNull(); var okResult = result.Should().BeOfType <OkObjectResult>().Subject; Assert.True(okResult.StatusCode.Equals(200)); var model = okResult.Value.Should().BeAssignableTo <WidgetResponse>().Subject; Assert.False(model.DefaultCss.Equals(null)); Assert.True(model.Code.Length > 0); }