public async Task When_SessionEmpty_Then_ViewModelHasNoRTACode()
        {
            var controller = new ErrorController(_compositeSettings, _sessionService);

            controller.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext()
            };

            _sessionService.GetUserSession().ReturnsForAnyArgs(MockHelpers.GetUserSession(false));

            await controller.Body();

            var result = await controller.Body() as ViewResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <ViewResult>();

            ((ErrorCompositeViewModel)result.ViewData.Model).RTACode.Should().Be(string.Empty);
        }
Exemplo n.º 2
0
        public async Task WhenBodyCalled_ReturnHtml()
        {
            var controller = new ErrorController(_logger, _compositeSettings, _dssReader, _cosmosService, _options, _documentService, _config);

            controller.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext()
            };

            var result = await controller.Body() as ViewResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <ViewResult>();
            result.ViewName.Should().BeNull();
        }
        public async Task WhenBodyCalled_ReturnHtml()
        {
            var controller = new ErrorController(_compositeSettings, _sessionService);

            controller.ControllerContext = new ControllerContext
            {
                HttpContext = new DefaultHttpContext()
            };

            var result = await controller.Body() as ViewResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <ViewResult>();
            result.ViewName.Should().BeNull();
        }