public void DynamicWidgetDesignerContent_VerifyInvalidSortingOptionAsSetInAdvancedMode()
        {
            string sortExpession = "InvalidSortingExpression";
            var itemsCount = 5;
            string[] publishers = { "Ivan", "George", "Steve", "Ana", "Tom" };
            string[] expectedSortedItemsTitles = { "Title4", "Title3", "Title2", "Title1", "Title0" };

            try
            {
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SortExpression = sortExpession;

                for (int i = 0; i < itemsCount; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle("Title" + i, "Title" + i + "Url", publishers[i]);

                var items = dynamicController.Model.CreateListViewModel(null, 1).Items.ToArray();

                for (int i = 0; i < itemsCount; i++)
                {
                    Assert.AreEqual(expectedSortedItemsTitles[i], items[i].Identifier.ToString(), "The dynamic item with this title was not found!");
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
            }
        }
        public void DynamicWidgetsAllTypes_VerifyAllFieldsOnTheFrontendWhereSomeFieldsAreEmpty()
        {
            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);
            var dynamicCollection = ServerOperationsFeather.DynamicModuleAllTypes().RetrieveCollectionOfAllFields();

            try
            {
                ServerOperationsFeather.DynamicModuleAllTypes().CreateFieldWithTitle(this.dynamicTitles, this.dynamicUrls);

                dynamicCollection = ServerOperationsFeather.DynamicModuleAllTypes().RetrieveCollectionOfAllFields();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.AllItems;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                Assert.IsTrue(responseContent.Contains(this.dynamicTitles), "The dynamic item with this title was not found!");

                string detailNewsUrl = url + dynamicCollection[0].ItemDefaultUrl;
                string detailResponseContent = PageInvoker.ExecuteWebRequest(detailNewsUrl);

                Assert.IsTrue(detailResponseContent.Contains(this.dynamicTitles), "The title was not found!");
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        public void DynamicWidgetsDesignerContent_VerifyAllFunctionality()
        {
            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);
            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.AllItems;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    Assert.IsTrue(responseContent.Contains(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Taxonomies().DeleteTags(this.tagTitle);
            }
        }
        public void DynamicWidgetsPageTemplate_DynamicWidgetOnPageTemplate()
        {
            ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(DynamicTitle, DynamicUrl);
            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix);
            Guid templateId = default(Guid);

            try
            {
                templateId = this.templateOperation.DuplicatePageTemplate(OldTemplateName, TemplateName);

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.templateOperation.AddControlToTemplate(templateId, mvcProxy, PlaceHolder, Widget);
                Guid pageId = this.locationGenerator.CreatePage(pageNamePrefix, pageTitlePrefix, urlNamePrefix, null, null);
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().SetTemplateToPage(pageId, templateId);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                Assert.IsTrue(responseContent.Contains(DynamicTitle), "The dynamic item with this title was not found!");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().DeletePageTemplate(templateId);
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        public void DynamicWidgets_SelectByCategoryFunctionalityAndPaging()
        {
            var dynamicController = new DynamicContentController();
            dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
            dynamicController.Model.DisplayMode = ListDisplayMode.Paging;
            int itemsPerPage = 3;
            dynamicController.Model.ItemsPerPage = itemsPerPage;
            string categoryTitle = "Category";
            string[] itemsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            string[] urls = { "AngelUrl", "BoatUrl", "CatUrl", "KittyUrl", "DogUrl" };

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "1", categoryTitle + "0");

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var category0 = taxonomyManager.GetTaxa<HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "0");
                var category1 = taxonomyManager.GetTaxa<HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "1");

                for (int i = 0; i < itemsTitles.Count(); i++)
                {
                    if (i == 0)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category0.Id);
                    }
                    else if (i > 0 && i <= 3)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category0.Id);
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category1.Id);
                    }
                    else
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category1.Id);
                    }
                }

                this.VerifyCorrectItemsOnPageWithCategoryFilterAndPaging(category0, category1, dynamicController, itemsTitles);
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                this.serverOperationsTaxonomies.DeleteCategories("Category0", "Category1");
            }
        }
        public void DynamicWidgets_SelectByCategoryFunctionalityAndLimits()
        {
            var dynamicController = new DynamicContentController();
            dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
            dynamicController.Model.DisplayMode = ListDisplayMode.Limit;
            int itemsPerPage = 3;
            dynamicController.Model.ItemsPerPage = itemsPerPage;
            string categoryTitle = "Category";
            string[] itemsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            string[] urls = { "AngelUrl", "BoatUrl", "CatUrl", "KittyUrl", "DogUrl" };

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "1", categoryTitle + "0");

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var category0 = taxonomyManager.GetTaxa<HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "0");
                var category1 = taxonomyManager.GetTaxa<HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + "1");

                for (int i = 0; i < itemsTitles.Count(); i++)
                {
                    if (i <= 3)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category0.Id);
                    }
                    else
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], Guid.Empty, category1.Id);
                    }
                }

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category0, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(3), "Number of items is not correct");
                for (int i = 0; i <= 2; i++)
                {
                    Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(itemsTitles[3 - i], StringComparison.CurrentCulture), "The items with this title was found!");
                }

                modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category1, page: 1);
                dynamicItems = modelItems.Items.ToList();
                itemsCount = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(1), "Number of items is not correct");
                Assert.IsTrue(dynamicItems[0].Fields.Title.Equals(itemsTitles[4], StringComparison.CurrentCulture), "The items with this title was found!");

                dynamicController.Model.DisplayMode = ListDisplayMode.All;

                modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category0, page: 1);
                dynamicItems = modelItems.Items.ToList();
                itemsCount = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(4), "Number of items is not correct");
                for (int i = 0; i <= 3; i++)
                {
                    Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(itemsTitles[3 - i], StringComparison.CurrentCulture), "The items with this title was found!");
                }

                modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category1, page: 1);
                dynamicItems = modelItems.Items.ToList();
                itemsCount = dynamicItems.Count;

                Assert.IsTrue(itemsCount.Equals(1), "Number of items is not correct");
                Assert.IsTrue(dynamicItems[0].Fields.Title.Equals(itemsTitles[4], StringComparison.CurrentCulture), "The items with this title was found!");
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                this.serverOperationsTaxonomies.DeleteCategories("Category0", "Category1");
            }
        }
        public void DynamicWidgetsDesignerContent_VerifyDynamicItemsByTagFunctionality()
        {
            try
            {
                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();
                var taxonId = this.CreatePressArticleAndReturnTagId(this.tagTitles);

                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);

                for (int i = 0; i < taxonId.Length; i++)
                {
                    var tag = taxonomyManager.GetTaxa<FlatTaxon>().Where(t => t.Id == taxonId[i]).FirstOrDefault();

                    var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: tag, page: 1);
                    var dynamicItems = modelItems.Items.ToList();
                    int itemsCount = dynamicItems.Count;

                    Assert.AreEqual(1, itemsCount, "The count of the dynamic item is not as expected");

                    string title = dynamicItems[0].Fields.Title;
                    Assert.IsTrue(title.Equals(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Taxonomies().DeleteTags(this.tagTitles);
            }
        }
        public void DynamicWidgetsDesignerListSettings_VerifyPublicationDateDescending()
        {
            string sortExpession = "PublicationDate DESC";
            DateTime publicationDateAngel = new DateTime(2014, 9, 10, 12, 00, 00);
            DateTime publicationDateBoat = new DateTime(2014, 10, 23, 12, 00, 00);
            DateTime publicationDateCat = new DateTime(2014, 11, 18, 12, 00, 00);

            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                ServerOperationsFeather.DynamicModulePressArticle().PublishPressArticleWithSpecificDate(dynamicCollection[4], publicationDateAngel);
                ServerOperationsFeather.DynamicModulePressArticle().PublishPressArticleWithSpecificDate(dynamicCollection[2], publicationDateBoat);
                ServerOperationsFeather.DynamicModulePressArticle().PublishPressArticleWithSpecificDate(dynamicCollection[0], publicationDateCat);

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SortExpression = sortExpession;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;
                string[] dynamicTitlesResults = new string[itemsCount];

                Assert.AreEqual(this.dynamicTitles.Length, itemsCount, "The count of the dynamic item is not as expected");

                for (int i = 0; i < itemsCount; i++)
                    dynamicTitlesResults[i] = dynamicItems[i].Fields.Title;

                for (int i = 0; i < dynamicTitlesResults.Length; i++)
                    Assert.IsTrue(dynamicTitlesResults[i].Equals(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        private void VerifyCorrectItemsOnPageWithCategoryFilterAndPaging(HierarchicalTaxon category0, HierarchicalTaxon category1, DynamicContentController dynamicController, string[] itemsTitles)
        {
            var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category0, page: 1);
            var dynamicItems = modelItems.Items.ToList();
            int itemsCount = dynamicItems.Count;

            Assert.IsTrue(itemsCount.Equals(3), "Number of items is not correct");
            for (int i = 0; i <= 2; i++)
            {
                Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(itemsTitles[3 - i], StringComparison.CurrentCulture), "The items with this title was found!");
            }

            modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category0, page: 2);
            dynamicItems = modelItems.Items.ToList();
            itemsCount = dynamicItems.Count;

            Assert.IsTrue(itemsCount.Equals(1), "Number of items is not correct");
            Assert.IsTrue(dynamicItems[0].Fields.Title.Equals(itemsTitles[0], StringComparison.CurrentCulture), "The items with this title was found!");

            modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category1, page: 1);
            dynamicItems = modelItems.Items.ToList();
            itemsCount = dynamicItems.Count;

            Assert.IsTrue(itemsCount.Equals(3), "Number of items is not correct");
            for (int i = 0; i <= 2; i++)
            {
                Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(itemsTitles[4 - i], StringComparison.CurrentCulture), "The items with this title was found!");
            }

            modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: category1, page: 2);
            dynamicItems = modelItems.Items.ToList();
            itemsCount = dynamicItems.Count;

            Assert.IsTrue(itemsCount.Equals(1), "Number of items is not correct");
            Assert.IsTrue(dynamicItems[0].Fields.Title.Equals(itemsTitles[1], StringComparison.CurrentCulture), "The items with this title was found!");
        }
Exemplo n.º 10
0
        public void AddDynamicWidgetToPage(Guid pageId, string type, string widgetName, string widgetCaption, string placeholder = "Body")
        {
            using (var mvcProxy = new MvcWidgetProxy())
            {
                PageManager pageManager = PageManager.GetManager();
                pageManager.Provider.SuppressSecurityChecks = true;
                var pageDataId = pageManager.GetPageNode(pageId).PageId;
                var page = pageManager.EditPage(pageDataId, CultureInfo.CurrentUICulture);

                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(type);
                if (ServerOperations.MultiSite().CheckIsMultisiteMode())
                {
                    dynamicController.Model.ProviderName = "dynamicContentProvider";
                }

                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = widgetName;

                this.CreateControl(pageManager, page, mvcProxy, widgetCaption, placeholder);
            }
        }
        public void DynamicWidgetsDesignerListSettings_DeleteSelectedListTemplate()
        {
            string listTemplate = "PressArticleNew";
            string paragraphText = "List template";
            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);

            string file = null;

            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                file = this.CopyFile();

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.ListTemplateName = listTemplate;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                File.Delete(file);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                Assert.IsFalse(responseContent.Contains(paragraphText), "The paragraph text was found!");

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    Assert.IsFalse(responseContent.Contains(this.dynamicTitles[i]), "The dynamic item with this title was found!");
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
                Directory.Delete(this.folderPath);
            }
        }
        public void DynamicWidgetsDesignerListSettings_VerifyUsePagingFunctionality()
        {
            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            int itemsPerPage = 1;
            string index2 = "/2";
            string index3 = "/3";
            string url1 = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);
            string url2 = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index + index2);
            string url3 = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index + index3);

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.DisplayMode = ListDisplayMode.Paging;
                dynamicController.Model.ItemsPerPage = itemsPerPage;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                string responseContent1 = PageInvoker.ExecuteWebRequest(url1);
                string responseContent2 = PageInvoker.ExecuteWebRequest(url2);
                string responseContent3 = PageInvoker.ExecuteWebRequest(url3);

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                {
                    switch (i)
                    {
                        case 0:
                            Assert.IsTrue(responseContent3.Contains(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                            Assert.IsFalse(responseContent3.Contains(this.dynamicTitles[i + 1]), "The dynamic item with this title was found!");
                            Assert.IsFalse(responseContent3.Contains(this.dynamicTitles[i + 2]), "The dynamic item with this title was found!");
                            break;
                        case 1:
                            Assert.IsTrue(responseContent2.Contains(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                            Assert.IsFalse(responseContent2.Contains(this.dynamicTitles[i + 1]), "The dynamic item with this title was found!");
                            Assert.IsFalse(responseContent2.Contains(this.dynamicTitles[i - 1]), "The dynamic item with this title was found!");
                            break;
                        case 2:
                            Assert.IsTrue(responseContent1.Contains(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                            Assert.IsFalse(responseContent1.Contains(this.dynamicTitles[i - 1]), "The dynamic item with this title was found!");
                            Assert.IsFalse(responseContent1.Contains(this.dynamicTitles[i - 2]), "The dynamic item with this title was found!");
                            break;
                    }
                }
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        public void DynamicWidgetsDesignerListSettings_VerifySortLastModified()
        {
            string sortExpession = "LastModified DESC";
            string newTitle = "Boat New Name";

            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                ServerOperationsFeather.DynamicModulePressArticle().EditPressArticleTitle(dynamicCollection[2], newTitle);

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SortExpression = sortExpession;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;
                string[] dynamicTitlesResults = new string[itemsCount];

                Assert.AreEqual(this.dynamicTitles.Length, itemsCount, "The count of the dynamic item is not as expected");

                for (int i = 0; i < itemsCount; i++)
                    dynamicTitlesResults[i] = dynamicItems[i].Fields.Title;

                Assert.IsTrue(dynamicTitlesResults[0].Equals(newTitle), "The dynamic item with this title was not found!");
                Assert.IsFalse(dynamicTitlesResults[0].Equals(this.dynamicTitles[1]), "The dynamic item with this title was not found!");
                Assert.IsTrue(dynamicTitlesResults[1].Equals(this.dynamicTitles[2]), "The dynamic itemwith this title was not found!");
                Assert.IsTrue(dynamicTitlesResults[2].Equals(this.dynamicTitles[0]), "The dynamic item with this title was not found!");
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        public void DynamicWidgetsDesignerListSettings_VerifySortAscending()
        {
            string sortExpession = "Title ASC";
            string[] dynamicTitlesDescending = { "Cat", "Boat", "Angel" };
            string[] dynamicUrlsDescending = { "CatUrl", "BoatUrl", "AngelUrl" };

            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                for (int i = 0; i < dynamicTitlesDescending.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(dynamicTitlesDescending[i], dynamicUrlsDescending[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SortExpression = sortExpession;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;
                string[] dynamicTitlesResults = new string[itemsCount];

                Assert.AreEqual(dynamicTitlesDescending.Length, itemsCount, "The count of the dynamic item is not as expected");

                for (int i = 0; i < itemsCount; i++)
                    dynamicTitlesResults[i] = dynamicItems[i].Fields.Title;

                int lastIndex = itemsCount - 1;
                for (int i = 0; i < dynamicTitlesDescending.Length; i++)
                {
                    Assert.IsTrue(dynamicTitlesResults[i].Equals(dynamicTitlesDescending[lastIndex]), "The dynamic item with this title was not found!");
                    lastIndex--;
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        public void DynamicWidgets_SelectByTagAndSortFunctionality()
        {
            int tagsCount = 3;
            Guid[] taxonId = new Guid[tagsCount];
            string sortExpession = "Title ASC";
            string[] itemsTitles = { "Boat", "Cat", "Angel", "Kitty", "Dog" };
            string[] urls = { "AngelUrl", "BoatUrl", "CatUrl", "KittyUrl", "DogUrl" };
            string[] sortedTitles = { "Angel", "Boat", "Cat" };

            var dynamicController = new DynamicContentController();
            dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
            dynamicController.Model.SortExpression = sortExpession;

            try
            {
                for (int i = 0; i < tagsCount; i++)
                {
                    taxonId[i] = this.serverOperationsTaxonomies.CreateFlatTaxon(Telerik.Sitefinity.TestUtilities.CommonOperations.TaxonomiesConstants.TagsTaxonomyId, this.tagTitles[i]);
                }

                for (int i = 0; i < itemsTitles.Count(); i++)
                {
                    if (i <= 2)
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], taxonId[0], Guid.Empty);
                    }
                    else
                    {
                        ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(itemsTitles[i], urls[i], taxonId[i - 2], Guid.Empty);
                    }
                }

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

                for (int i = 0; i < tagsCount; i++)
                {
                    var tag = taxonomyManager.GetTaxa<FlatTaxon>().Where(t => t.Id == taxonId[i]).FirstOrDefault();
                    var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: tag, page: 1);
                    var dynamicItems = modelItems.Items.ToList();
                    int itemsCount = dynamicItems.Count;

                    if (i == 0)
                    {
                        for (int j = 0; j < itemsCount; j++)
                            Assert.IsTrue(dynamicItems[j].Fields.Title.Equals(sortedTitles[j], StringComparison.CurrentCulture), "The item with this title was not found!");
                    }
                    else
                    {
                        for (int j = 0; j < itemsCount; j++)
                            Assert.IsTrue(dynamicItems[j].Fields.Title.Equals(itemsTitles[i + 2], StringComparison.CurrentCulture), "The item with this title was not found!");
                    }
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
                this.serverOperationsTaxonomies.DeleteTags(this.tagTitles);
            }
        }
        public void DynamicWidgets_VerifySelectedItemsFunctionalityWithSortDescending()
        {
            string sortExpession = "Title DESC";
            string[] selectedDynamicTitles = { "Title2", "Title7", "Title5" };
            string[] expectedDynamicTitles = { "Title7", "Title5", "Title2" };

            try
            {
                for (int i = 0; i < 10; i++)
                {
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem("Title" + i, "Title" + i + "Url");
                }

                var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.SelectedItems;
                dynamicController.Model.SortExpression = sortExpession;

                var selectedDynamicItems = new DynamicContent[3];

                for (int i = 0; i < selectedDynamicTitles.Count(); i++)
                {
                    selectedDynamicItems[i] = dynamicCollection.FirstOrDefault<DynamicContent>(n => n.UrlName == (selectedDynamicTitles[i] + "Url"));
                }

                //// SerializedSelectedItemsIds string should appear in the following format: "[\"ca782d6b-9e3d-6f9e-ae78-ff00006062c4\",\"66782d6b-9e3d-6f9e-ae78-ff00006062c4\"]"
                dynamicController.Model.SerializedSelectedItemsIds =
                                                                    "[\"" + selectedDynamicItems[0].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[1].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[2].Id.ToString() + "\"]";

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;

                for (int i = 0; i < itemsCount; i++)
                {
                    Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(expectedDynamicTitles[i]), "The item with this title was not found!");
                }

                dynamicController.Model.SelectionMode = SelectionMode.AllItems;

                modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                dynamicItems = modelItems.Items.ToList();

                int lastIndex = 9;
                for (int i = 0; i < 10; i++)
                {
                    Assert.IsTrue(dynamicItems[i].Fields.Title.Equals(this.dynamicTitle + lastIndex), "The item with this title was not found!");
                    lastIndex--;
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
            }
        }
        private MvcWidgetProxy CreateMvcWidget(string resolveType, string widgetName, string relatedFieldName = null, string relatedItemType = null, RelationDirection relationTypeToDisplay = RelationDirection.Child)
        {
            var mvcProxy = new MvcWidgetProxy();
            mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
            var dynamicController = new DynamicContentController();
            dynamicController.Model.ContentType = TypeResolutionService.ResolveType(resolveType);
            dynamicController.Model.RelatedFieldName = relatedFieldName;
            dynamicController.Model.RelatedItemType = relatedItemType;
            dynamicController.Model.RelationTypeToDisplay = relationTypeToDisplay;

            mvcProxy.Settings = new ControllerSettings(dynamicController);
            mvcProxy.WidgetName = widgetName;

            return mvcProxy;
        }
        public void DynamicWidgets_VerifySelectedItemsFunctionalityWithUseLimit()
        {
            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);

            try
            {
                for (int i = 0; i < 20; i++)
                {
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem("Title" + i, "Title" + i + "Url");
                }

                var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.SelectedItems;
                dynamicController.Model.DisplayMode = ListDisplayMode.Limit;
                dynamicController.Model.ItemsPerPage = 5;
                dynamicController.Model.SortExpression = AsSetManuallySortingOption;

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                string[] selectedDynamicTitles = { "Title7", "Title15", "Title11", "Title3", "Title5", "Title8", "Title2", "Title16", "Title6" };
                var selectedDynamicItems = new DynamicContent[9];

                for (int i = 0; i < selectedDynamicTitles.Count(); i++)
                {
                    selectedDynamicItems[i] = dynamicCollection.FirstOrDefault<DynamicContent>(n => n.UrlName == (selectedDynamicTitles[i] + "Url"));
                }

                //// SerializedSelectedItemsIds string should appear in the following format: "[\"ca782d6b-9e3d-6f9e-ae78-ff00006062c4\",\"66782d6b-9e3d-6f9e-ae78-ff00006062c4\"]"
                dynamicController.Model.SerializedSelectedItemsIds =
                                                                    "[\"" + selectedDynamicItems[0].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[1].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[2].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[3].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[4].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[5].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[6].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[7].Id.ToString() + "\"," +
                                                                    "\"" + selectedDynamicItems[8].Id.ToString() + "\"]";

                this.VerifyCorrectItemsOnPageWithUseLimitsOption(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index, url, selectedDynamicTitles);
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles());
            }
        }
        public void DynamicWidgetsDesignerSingleItemSettingsTests_DeleteSelectedDetailTemplate()
        {
            string detailTemplate = "PressArticleNew";
            string paragraphText = "Detail template";
            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);

            string fileDeatil = null;
            string fileList = null;

            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                fileDeatil = this.CopyFile(DynamicFileName, DynamicFileFileResource);
                fileList = this.CopyFile(DynamicFileListName, DynamicFileListFileResource);

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.ProviderName = ((Telerik.Sitefinity.Data.DataProviderBase)dynamicCollection.First().Provider).Name;
                dynamicController.ListTemplateName = detailTemplate;
                dynamicController.DetailTemplateName = detailTemplate;
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                File.Delete(fileDeatil);

                string detailNewsUrl = url + dynamicCollection[0].ItemDefaultUrl;
                string responseContent = PageInvoker.ExecuteWebRequest(detailNewsUrl);

                Assert.IsFalse(responseContent.Contains(paragraphText), "The paragraph text was found!");

                Assert.IsTrue(responseContent.Contains(this.dynamicTitles[0]), "The dynamic item with this title was not found!");
                Assert.IsFalse(responseContent.Contains(this.dynamicTitles[1]), "The dynamic item with this title was found!");
                Assert.IsFalse(responseContent.Contains(this.dynamicTitles[2]), "The dynamic item with this title was found!");
            }
            finally
            {
                File.Delete(fileList);
                Directory.Delete(this.folderPath);
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
        public void DynamicWidgetsDesignerContent_VerifySelectedItemsFunctionality()
        {
            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.SelectedItems;
                dynamicController.Model.SerializedSelectedItemsIds = "[\"" + dynamicCollection[3].Id.ToString() + "\"]";
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;

                Assert.AreEqual(1, itemsCount, "The count of the dynamic item is not as expected");

                string title = dynamicItems[0].Fields.Title;
                Assert.IsTrue(title.Equals(this.dynamicTitles[1]), "The dynamic item with this title was not found!");
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Taxonomies().DeleteTags(this.tagTitle);
            }
        }
        private MvcWidgetProxy CreateMvcWidget(string resolveType, string widgetName, string[] selectedItemsIds = null)
        {
            var mvcProxy = new MvcWidgetProxy();
            mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
            var dynamicController = new DynamicContentController();
            dynamicController.Model.ContentType = TypeResolutionService.ResolveType(resolveType);

            if (selectedItemsIds != null)
            {
                StringBuilder sb = new StringBuilder();

                foreach (var id in selectedItemsIds)
                {
                    sb.Append("\"");
                    sb.Append(id);
                    sb.Append("\"");

                    if (Array.IndexOf(selectedItemsIds, id) < selectedItemsIds.Length - 1)
                    {
                        sb.Append(",");
                    }
                }

                dynamicController.Model.SerializedSelectedParentsIds = "[" + sb.ToString() + "]";
            }

            mvcProxy.Settings = new ControllerSettings(dynamicController);
            mvcProxy.WidgetName = widgetName;

            return mvcProxy;
        }
        public void DynamicWidgetsDesignerContent_VerifyDynamicItemsByPublicationDateCustomRangeFunctionality()
        {
            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                DateTime publicationDate = new DateTime(2014, 10, 23, 12, 00, 00);

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();
                ServerOperationsFeather.DynamicModulePressArticle().PublishPressArticleWithSpecificDate(dynamicCollection[4], publicationDate);

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.FilteredItems;
                dynamicController.Model.SerializedAdditionalFilters = @"{
            ""QueryItems"":[
                {
                    ""IsGroup"":true,
                    ""Ordinal"":0,
                    ""Join"":""AND"",
                    ""ItemPath"":""_0"",
                    ""Value"":null,
                    ""Condition"":null,
                    ""Name"":""PublicationDate""
                },
                {
                    ""IsGroup"":false,
                    ""Ordinal"":0,
                    ""Join"":""AND"",
                    ""ItemPath"":""_0_0"",
                    ""Value"":""Wed, 22 Oct 2014 21:00:00 GMT"",
                    ""Condition"":
                        {
                            ""FieldName"":""PublicationDate"",
                            ""FieldType"":""System.DateTime"",
                            ""Operator"":"">""
                        },
                    ""Name"":""PublicationDate.Wed, 22 Oct 2014 21:00:00 GMT""
                },
                {
                    ""IsGroup"":false,
                    ""Ordinal"":1,
                    ""Join"":""AND"",
                    ""ItemPath"":""_0_1"",
                    ""Value"":""Fri, 24 Oct 2014 21:00:00 GMT"",
                    ""Condition"":
                        {
                            ""FieldName"":""PublicationDate"",
                            ""FieldType"":""System.DateTime"",
                            ""Operator"":""<""
                        },
                    ""Name"":""PublicationDate.Fri, 24 Oct 2014 21:00:00 GMT""
                }";

                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                var modelItems = dynamicController.Model.CreateListViewModel(taxonFilter: null, page: 1);
                var dynamicItems = modelItems.Items.ToList();
                int itemsCount = dynamicItems.Count;

                Assert.AreEqual(1, itemsCount, "The count of the dynamic item is not as expected");

                string title1 = dynamicItems[0].Fields.Title;
                Assert.IsTrue(title1.Equals(this.dynamicTitles[2]), "The dynamic item with this title was not found!");

                for (int i = 0; i < itemsCount; i++)
                {
                    string titleNotExist = dynamicItems[i].Fields.Title;
                    Assert.IsFalse(titleNotExist.Equals(this.dynamicTitles[0]), "The dynamic item with this title was found!");
                    Assert.IsFalse(titleNotExist.Equals(this.dynamicTitles[1]), "The dynamic item with this title was found!");
                }
            }
            finally
            {
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Taxonomies().DeleteTags(this.tagTitle);
            }
        }
        public void DynamicWidgetsDesignerListSettings_VerifyNoLimitAndPagingFunctionality()
        {
            var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            this.pageOperations = new PagesOperations();
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "DynamicPage";
            string pageTitlePrefix = testName + "Dynamic Page";
            string urlNamePrefix = testName + "dynamic-page";
            int index = 1;
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                Assert.IsNotNull(dynamicCollection, "The collection of press articles was NULL.");

                this.pageOperations = new PagesOperations();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.DisplayMode = ListDisplayMode.All;
                dynamicController.Model.ProviderName = "dynamicContentProvider";
                mvcProxy.Settings = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);
                string responseContent = PageInvoker.ExecuteWebRequest(url);

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                {
                    Assert.IsTrue(responseContent.Contains(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                }
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }