Ejemplo n.º 1
0
        public void FlatTaxonomy_ContentId_BaseUrl()
        {
            this.CreateTestData();

            var index = 1;
            var filterPageName = "filterPage";
            var filterPageUrl = "filter-page";

            var mvcProxy = new MvcWidgetProxy();
            mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName;
            var flatTaxonomyController = new FlatTaxonomyController();
            flatTaxonomyController.Model.TaxaToDisplay = FlatTaxaToDisplay.UsedByContentType;
            flatTaxonomyController.Model.ContentTypeName = "Telerik.Sitefinity.News.Model.NewsItem";
            flatTaxonomyController.Model.ContentId = this.newsIds[0]; // news1 id
            flatTaxonomyController.Model.BaseUrl = "~/" + filterPageUrl;
            mvcProxy.Settings = new ControllerSettings(flatTaxonomyController);

            this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index);
            this.serverPagesOperations.CreatePage(filterPageName, filterPageUrl);

            string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index);
            string responseContent = PageInvoker.ExecuteWebRequest(url);

            Assert.IsNotNull(responseContent);

            var urlPrefix = filterPageUrl + "/-in-tags/tags/";
            var expectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2)
            };

            var notExpectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1),
                new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 0),
            };

            this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount);
        }
Ejemplo n.º 2
0
        public void FlatTaxonomy_DefaultSettings()
        {
            this.CreateTestData();

            var mvcProxy = new MvcWidgetProxy();
            mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName;
            var flatTaxonomyController = new FlatTaxonomyController();
            mvcProxy.Settings = new ControllerSettings(flatTaxonomyController);

            var index = 1;

            this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index);

            string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index);
            string responseContent = PageInvoker.ExecuteWebRequest(url);

            Assert.IsNotNull(responseContent);

            var urlPrefix = PageUrl + index + "/-in-tags/tags/";
            var expectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2),
                new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1),
            };

            var notExpectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 0),
            };

            this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount);
        }
Ejemplo n.º 3
0
        public void FlatTaxonomy_SelectTags_ShowEmptyTags_SortManually()
        {
            this.CreateTestData();

            var mvcProxy = new MvcWidgetProxy();
            mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName;
            var flatTaxonomyController = new FlatTaxonomyController();
            flatTaxonomyController.Model.ShowEmptyTaxa = true;
            flatTaxonomyController.Model.TaxaToDisplay = FlatTaxaToDisplay.Selected;
            flatTaxonomyController.Model.SerializedSelectedTaxaIds = string.Format(
                        CultureInfo.InvariantCulture,
                        @"[""{0}"",""{1}""]",
                        this.taxaIds[2],
                        this.taxaIds[1]);
            flatTaxonomyController.Model.SortExpression = "AsSetManually";
            mvcProxy.Settings = new ControllerSettings(flatTaxonomyController);

            var index = 1;

            this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index);

            string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index);
            string responseContent = PageInvoker.ExecuteWebRequest(url);

            Assert.IsNotNull(responseContent);

            var urlPrefix = PageUrl + index + "/-in-tags/tags/";
            var expectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 0),
                new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1)
            };

            var notExpectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2)
            };

            this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount);
        }
Ejemplo n.º 4
0
        public void FlatTaxonomy_SelectTagsByContentType_DynamicContentTypeName()
        {
            this.CreateTestData();
            this.CreateDynamicContentTypeTestData();

            var mvcProxy = new MvcWidgetProxy();
            mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName;
            var flatTaxonomyController = new FlatTaxonomyController();
            flatTaxonomyController.Model.TaxaToDisplay = FlatTaxaToDisplay.UsedByContentType;
            flatTaxonomyController.Model.DynamicContentTypeName = "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle";
            mvcProxy.Settings = new ControllerSettings(flatTaxonomyController);

            var index = 1;

            this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index);

            string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index);
            string responseContent = PageInvoker.ExecuteWebRequest(url);

            Assert.IsNotNull(responseContent);

            var urlPrefix = PageUrl + index + "/-in-tags/tags/";
            var expectedTags = new List<Tag>()
            {
                // the count will show how many dynamic content items has assigned tag2 (not news) -> only one
                new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1),
            };

            var notExpectedTags = new List<Tag>()
            {
                new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2),
                new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 1),
            };

            this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount);
        }