public void Build()
        {
            // Arrange
            var appConfigViewModel = _fixture.Create <AppConfigViewModel>();
            var appConfigData      = _fixture.Create <string>();

            _appConfigViewModelBuilder.Setup(p => p.Build())
            .Returns(appConfigViewModel);
            _serializer.Setup(p => p.Serialize(appConfigViewModel))
            .Returns(appConfigData);

            var expected = new HomeViewModel
            {
                AppConfigData = appConfigData
            };

            // Act
            var result = _target.Build();

            // Assert
            result.Should().BeEquivalentTo(expected);

            _appConfigViewModelBuilder.Verify(p => p.Build(), Times.Once);
            _serializer.Verify(p => p.Serialize(appConfigViewModel), Times.Once);
        }
예제 #2
0
 public IActionResult Index(PageModel currentPageModel, Guid?previewGlobalBlock = null)
 {
     if (previewGlobalBlock != null && _authorizationService.HasOperation(Operations.Function.Websites.UI))
     {
         return(View("Index", _builder.ForPreviewGlobalBlock(previewGlobalBlock.Value)));
     }
     return(View(_builder.Build(currentPageModel)));
 }
예제 #3
0
        public ActionResult Index(PageModel currentPageModel)
        {
            var previewBlockId = Request.QueryString["previewGlobalBlock"];

            if (!string.IsNullOrEmpty(previewBlockId) && Guid.TryParse(previewBlockId, out var blockId) && _authorizationService.HasOperation(Operations.Function.Websites.UI))
            {
                return(View("Index", _builder.ForPreviewGlobalBlock(blockId)));
            }
            return(View(_builder.Build(currentPageModel)));
        }
예제 #4
0
        public ActionResult Index()
        {
            HomeViewModelBuilder builder = new HomeViewModelBuilder();

            return(View(builder.Build()));
        }
예제 #5
0
        public async Task <IActionResult> Index()
        {
            var vm = await _builder.Build();

            return(View(vm));
        }