Esempio n. 1
0
        public void Then_The_Cards_Are_Built(CmsContent source, EntryFields linkedPage, MenuPageModel.MenuPageContent menuContent, BannerPageModel bannerContent)
        {
            //Arrange
            source.Items[0].Fields.Cards[0].Sys.Id = "2K5MZPYdhDNyPEsDk4EgZh";
            source.Includes.Entry = new List <Entry>
            {
                new Entry
                {
                    Sys = new AssetSys
                    {
                        Id    = "2K5MZPYdhDNyPEsDk4EgZh",
                        Space = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "123abc",
                                Type     = "Link",
                                LinkType = "Space"
                            }
                        },
                        ContentType = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "article",
                                LinkType = "ContentType",
                                Type     = "Link",
                            }
                        }
                    },
                    Fields = linkedPage
                }
            };

            //Act
            var actual = new LandingPageModel().Build(source, menuContent, bannerContent);

            //Assert
            actual.MainContent.Cards.Count.Should().Be(1);
            actual.MainContent.Cards.TrueForAll(c => c.Title.Equals(linkedPage.Title)).Should().BeTrue();
            actual.MainContent.Cards.TrueForAll(c => c.Summary.Equals(linkedPage.Summary)).Should().BeTrue();
            actual.MainContent.Cards.TrueForAll(c => c.Slug.Equals(linkedPage.Slug)).Should().BeTrue();
            actual.MainContent.Cards.TrueForAll(c => c.HubType.Equals(linkedPage.HubType)).Should().BeTrue();
            actual.MainContent.Cards.TrueForAll(c => c.MetaDescription.Equals(linkedPage.MetaDescription)).Should().BeTrue();
        }
Esempio n. 2
0
        public void Then_The_Attachments_Are_Built(CmsContent source, EntryFields linkedPage, AssetFields fields, string linkedContentId, MenuPageModel.MenuPageContent menuContent, BannerPageModel bannerContent)
        {
            //Arrange
            fields.File.Url = $"//{fields.File.Url}";
            source.Items.FirstOrDefault().Fields.Attachments = new List <LandingPage>
            {
                new LandingPage
                {
                    Sys = new LandingPageSys
                    {
                        Id       = linkedContentId,
                        Type     = "Link",
                        LinkType = "Asset"
                    }
                }
            };
            source.Includes.Asset = new List <Asset>()
            {
                new Asset
                {
                    Sys = new AssetSys
                    {
                        Id = linkedContentId,
                    },
                    Fields = fields
                }
            };

            //Act
            var actual = new CmsPageModel().Build(source, menuContent, bannerContent);

            //Assert
            actual.Attachments.Count.Should().Be(1);
            actual.Attachments[0].Id.Should().Be(linkedContentId);
            actual.Attachments[0].Title.Should().Be(fields.Title);
            actual.Attachments[0].Url.Should().Be($"https:{fields.File.Url}");
            actual.Attachments[0].ContentType.Should().Be(fields.File.ContentType);
            actual.Attachments[0].FileName.Should().Be(fields.File.FileName);
            actual.Attachments[0].Size.Should().Be(fields.File.Details.Size);
            actual.Attachments[0].Description.Should().Be(fields.Description);
        }
Esempio n. 3
0
        public void Then_The_Urls_Are_Built(CmsContent source, EntryFields linkedPage)
        {
            source.Items[0].Fields.MenuItems[0].Sys.Id = "2K5MZPYdhDNyPEsDk4EgZh";

            source.Includes.Entry = new List <Entry>
            {
                new Entry
                {
                    Sys = new AssetSys
                    {
                        Id    = "2K5MZPYdhDNyPEsDk4EgZh",
                        Space = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "123abc",
                                Type     = "Link",
                                LinkType = "Space"
                            }
                        },
                        ContentType = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "article",
                                LinkType = "ContentType",
                                Type     = "Link",
                            }
                        }
                    },
                    Fields = linkedPage
                }
            };

            var actual = new MenuPageModel().Build(source);

            actual.MainContent.Should().NotBeNullOrEmpty();
            actual.MainContent[0].Title.Should().NotBeNullOrWhiteSpace();
            actual.MainContent[0].Hub.Should().NotBeNullOrWhiteSpace();
            actual.MainContent[0].Slug.Should().NotBeNullOrWhiteSpace();
        }
Esempio n. 4
0
        public void Then_Any_Tabbed_Content_Is_Added_To_The_Content_Items(CmsContent source, EntryFields linkedPage, MenuPageModel.MenuPageContent menuContent, BannerPageModel bannerContent)
        {
            source.Items.FirstOrDefault().Fields.TabbedContents[0].Sys.Id = "321EDF";
            source.Items.FirstOrDefault().Fields.TabbedContents[1].Sys.Id = "321EDC";
            //Arrange
            source.Includes.Entry = new List <Entry>
            {
                new Entry
                {
                    Sys = new AssetSys
                    {
                        Id    = "321EDF",
                        Space = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "123abc",
                                Type     = "Link",
                                LinkType = "Space"
                            }
                        },
                        ContentType = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "tab",
                                LinkType = "ContentType",
                                Type     = "Link",
                            }
                        }
                    },
                    Fields = linkedPage
                },
                new Entry
                {
                    Sys = new AssetSys
                    {
                        Id    = "321EDC",
                        Space = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "123abc",
                                Type     = "Link",
                                LinkType = "Space",
                            }
                        },
                        ContentType = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "tab",
                                LinkType = "ContentType",
                                Type     = "Link",
                            }
                        }
                    },
                    Fields = linkedPage
                }
            };

            //Act
            var actual = new CmsPageModel().Build(source, menuContent, bannerContent);

            //Assert
            actual.TabbedContents.Any().Should().BeTrue();
            actual.TabbedContents.FirstOrDefault().TabTitle.Should().NotBeNullOrWhiteSpace();
            actual.TabbedContents.FirstOrDefault().TabName.Should().NotBeNullOrWhiteSpace();
        }
Esempio n. 5
0
        public void Then_The_Related_Articles_Are_Built(CmsContent source, EntryFields linkedPage, MenuPageModel.MenuPageContent menuContent, BannerPageModel bannerContent)
        {
            //Arrange
            source.Includes.Entry = new List <Entry>
            {
                new Entry
                {
                    Sys = new AssetSys
                    {
                        Id    = "321EDF",
                        Space = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "123abc",
                                Type     = "Link",
                                LinkType = "Space"
                            }
                        },
                        ContentType = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "landingPage",
                                LinkType = "ContentType",
                                Type     = "Link",
                            }
                        }
                    },
                    Fields = linkedPage
                },
                new Entry
                {
                    Sys = new AssetSys
                    {
                        Id    = "321EDC",
                        Space = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "123abc",
                                Type     = "Link",
                                LinkType = "Space",
                            }
                        },
                        ContentType = new LandingPage
                        {
                            Sys = new LandingPageSys
                            {
                                Id       = "article",
                                LinkType = "ContentType",
                                Type     = "Link",
                            }
                        }
                    },
                    Fields = linkedPage
                }
            };

            //Act
            var actual = new CmsPageModel().Build(source, menuContent, bannerContent);

            //Assert
            actual.RelatedArticles.Count.Should().Be(1);
            actual.RelatedArticles.TrueForAll(c => c.Title.Equals(linkedPage.Title)).Should().BeTrue();
            actual.RelatedArticles.TrueForAll(c => c.Summary.Equals(linkedPage.Summary)).Should().BeTrue();
            actual.RelatedArticles.TrueForAll(c => c.Slug.Equals(linkedPage.Slug)).Should().BeTrue();
            actual.RelatedArticles.TrueForAll(c => c.HubType.Equals(linkedPage.HubType)).Should().BeTrue();
            actual.RelatedArticles.TrueForAll(c => c.MetaDescription.Equals(linkedPage.MetaDescription)).Should().BeTrue();
        }