예제 #1
0
        public async Task RecipeVisualization_notFound()
        {
            var repository = new WidgetRepository(_options, new HttpClient());
            var controller = new WidgetsController(repository, _mapper, _logger);

            var result = await controller.RecipeVisualization(-1);

            result.Should().NotBeNull();
            var okResult = result.Should().BeOfType <NotFoundResult>().Subject;

            Assert.True(okResult.StatusCode.Equals(404));
        }
예제 #2
0
        public async Task RecipeVisualization_okResult()
        {
            var repository = new WidgetRepository(_options, new HttpClient());
            var controller = new WidgetsController(repository, _mapper, _logger);

            var result = await controller.RecipeVisualization(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);
        }