Esempio n. 1
0
        public NavigationModel(
            PageSelectionMode selectionMode, 
            Guid selectedPageId,
            SelectedPageModel[] selectedPages,
            int? levelsToInclude, 
            bool showParentPage, 
            string cssClass,
            bool openExternalPageInNewTab)
        {
            this.SelectionMode = selectionMode;
            this.LevelsToInclude = levelsToInclude;
            this.ShowParentPage = showParentPage;
            this.CssClass = cssClass;
            this.selectedPageId = selectedPageId;
            this.selectedPages = selectedPages;
            this.OpenExternalPageInNewTab = openExternalPageInNewTab;

            this.InitializeNavigationWidgetSettings();
        }
        public void NavigationWidget_SelectedPages()
        {
            string pageName1 = "NavigationPage1";
            string pageTitle1 = "Navigation Page1";
            string urlName1 = "navigation-page1";

            string pageName2 = "NavigationPage2";
            string pageTitle2 = "Navigation Page2";
            string urlName2 = "navigation-page2";

            string pageName3 = "NavigationPage3";
            string pageTitle3 = "Navigation Page3";
            string urlName3 = "navigation-page3";

            var fluent = App.WorkWith();
            var page1Key = TestUtils.CreateAndPublishPage(fluent, PageLocation.Frontend, pageName1, pageTitle1, urlName1, null, false);
            this.createdPageIDs.Add(page1Key);

            var page2Key = TestUtils.CreateAndPublishPage(fluent, PageLocation.Frontend, pageName2, pageTitle2, urlName2, null, false);
            this.createdPageIDs.Add(page2Key);

            var page3Key = TestUtils.CreateAndPublishPage(fluent, PageLocation.Frontend, pageName3, pageTitle3, urlName3, null, false);
            this.createdPageIDs.Add(page3Key);

            var selectedPage1 = new SelectedPageModel();
            selectedPage1.Id = page1Key;
            var selectedPage2 = new SelectedPageModel();
            selectedPage2.Id = page2Key;

            var navModel = new NavigationModel(PageSelectionMode.SelectedPages, Guid.Empty, new[] { selectedPage1, selectedPage2 }, -1, false, string.Empty, false);

            var expectedCount = 2;
            var actualCount = navModel.Nodes.Count;
            Assert.AreEqual(expectedCount, actualCount);
            Assert.AreEqual(pageTitle1, navModel.Nodes[0].Title);
            Assert.AreEqual(pageTitle2, navModel.Nodes[1].Title);
        }