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); }
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))); }
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))); }
public ActionResult Index() { HomeViewModelBuilder builder = new HomeViewModelBuilder(); return(View(builder.Build())); }
public async Task <IActionResult> Index() { var vm = await _builder.Build(); return(View(vm)); }