public CmsPageModel Build(CmsContent article, MenuPageModel.MenuPageContent menu, BannerPageModel banners) { if (article.ContentItemsAreNullOrEmpty()) { return(null); } var item = article.Items.FirstOrDefault(); var pageTypeResult = item.Sys.ContentType.Sys.Id.GetPageType(); var contentItems = new List <ContentItem>(); if (item.Fields.Content?.Content == null) { return(GenerateCmsPageModel(article, item, pageTypeResult, contentItems, null, menu, banners)); } foreach (var contentItem in item.Fields.Content.Content) { article.ProcessContentNodeTypes(contentItem, contentItems); contentItem.ProcessListNodeTypes(contentItems); article.ProcessEmbeddedAssetBlockNodeTypes(contentItem, contentItems); } var parentPage = article.Includes.Entry.FirstOrDefault(c => c.Sys.Id.Equals(item.Fields.LandingPage?.Sys?.Id)); return(GenerateCmsPageModel(article, item, pageTypeResult, contentItems, parentPage, menu, banners)); }
public void Then_If_The_CmsContent_Is_Null_Then_True_Returned() { CmsContent ci = null; var actual = ci.ContentItemsAreNullOrEmpty(); actual.Should().BeTrue(); }
public SiteMapPageModel Build(CmsContent hub) { if (hub.ContentItemsAreNullOrEmpty()) { return(null); } return(GenerateHubPageModel(SetLandingPageDetails(hub))); }
A_CmsContent_Object_Is_Passed_To_ContentItemsAreNullOrEmpty_And_The_Total_Is_Zero_Then_Returns_True() { var ci = new CmsContent { Total = 0 }; var actual = ci.ContentItemsAreNullOrEmpty(); actual.Should().BeTrue(); }
public ApiMenuPageModel Build(CmsContent menu) { if (menu.ContentItemsAreNullOrEmpty()) { return(null); } var menuItems = ProcessMenuItems(menu); return(GenerateHubPageModel(SetMenuDetails(menuItems))); }
public BannerPageModel Build(CmsContent banner) { if (banner.ContentItemsAreNullOrEmpty()) { return(null); } var banners = IterateBannerItems(banner); return(GenerateHubPageModel(banners)); }
public LandingPageModel Build(CmsContent hub, MenuPageModel.MenuPageContent menu, BannerPageModel banners) { if (hub.ContentItemsAreNullOrEmpty()) { return(null); } var item = hub.Items.FirstOrDefault(); Enum.TryParse <PageType>(item.Sys.ContentType.Sys.Id, true, out var pageTypeResult); return(GenerateHubPageModel(item, pageTypeResult, ProcessCards(hub), ProcessHeaderImage(hub, item), menu, banners)); }
A_CmsContent_Object_Is_Passed_To_ContentItemsAreNullOrEmpty_And_The_Total_Is_Greater_Than_Zero_Then_Returns_False() { var ci = new CmsContent { Total = 1, Items = new List <Item> { new Item { Fields = new ItemFields { Summary = "summary" } } } }; var actual = ci.ContentItemsAreNullOrEmpty(); actual.Should().BeFalse(); }