public void PageBreak_SeparatorsMarkupIsCorrect() { var controller = new PageBreakController(); var control = new MvcWidgetProxy(); control.ControllerName = typeof(PageBreakController).FullName; control.Settings = new ControllerSettings(controller); var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "PageBreakValueTest", "page-break-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId); var formMultipageDecorator = ObjectFactory.Resolve <IFormMultipageDecorator>(); Assert.IsTrue(pageContent.Contains(formMultipageDecorator.SeparatorBegin), "Form did not render page separators"); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
private void ExecuteResponsesSearchTextTest(string[,] responsesFieldsValues, string searchedText, int expectedResultsCount) { var fieldsPerResponse = responsesFieldsValues.GetLength(1); var controls = new MvcWidgetProxy[fieldsPerResponse]; for (int i = 0; i < controls.Length; i++) { var control = new MvcWidgetProxy(); control.ControllerName = typeof(TextFieldController).FullName; var controller = new TextFieldController(); control.Settings = new ControllerSettings(controller); controls[i] = control; } var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(controls); var manager = FormsManager.GetManager(); var form = manager.GetForm(formId); var masterDetailView = new FormsMasterDetailView(); masterDetailView.FormDescription = form; var masterDetailDefinition = new MasterGridViewDefinition(); typeof(FormsMasterDetailView).GetMethod("ConfigureSearchFields", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(masterDetailView, new object[] { masterDetailDefinition }); var fields = masterDetailDefinition.SearchFields.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); Assert.AreEqual(fieldsPerResponse, fields.Length, string.Format(CultureInfo.InvariantCulture, "The produced search fields count ({0}) is not equal to the actual fields count on the form ({1})", fields.Length, fieldsPerResponse)); var service = new FormsService(); try { using (var fluent = App.WorkWith()) { for (int responseIndex = 0; responseIndex < responsesFieldsValues.GetLength(0); responseIndex++) { var formEntry = fluent.Forms().Form(form.Name).Entry().CreateNew(Guid.NewGuid()); for (int fieldValueIndex = 0; fieldValueIndex < responsesFieldsValues.GetLength(1); fieldValueIndex++) { formEntry.SetFieldValue(fields[fieldValueIndex], responsesFieldsValues[responseIndex, fieldValueIndex]); } formEntry.SaveChanges(); } } var filterClauses = fields.Select(f => string.Format(CultureInfo.InvariantCulture, "{0}.ToUpper().Contains(\"{1}\".ToUpper())", f, searchedText)); var filter = "(" + string.Join(" OR ", filterClauses) + ")"; var entries = service.GetFormEntries(form.Name, null, "Title ASC", 0, 50, filter, manager.Provider.FormsNamespace + "." + form.Name, null, Guid.Empty); Assert.AreEqual(expectedResultsCount, entries.TotalCount, string.Format(CultureInfo.InvariantCulture, "The returned search results ({0}) do not match the expected ones ({1})", entries.TotalCount, expectedResultsCount)); } finally { FormsModuleCodeSnippets.DeleteForm(formId); } }
public void TextField_EditInputType_MarkupIsCorrect() { var control = new MvcWidgetProxy(); control.ControllerName = typeof(TextFieldController).FullName; var controller = new TextFieldController(); controller.Model.InputType = Telerik.Sitefinity.Frontend.Forms.Mvc.Models.Fields.TextField.TextType.DateTimeLocal; control.Settings = new ControllerSettings(controller); var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "TextFieldTypeTest", "text-field-type-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId); Assert.IsTrue(pageContent.Contains("type=\"datetime-local\""), "Form did not render the input type in the text field."); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
public void FlatTaxonomy_DoNotShowCount() { this.CreateTestData(); var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName; var flatTaxonomyController = new FlatTaxonomyController(); flatTaxonomyController.Model.ShowItemCount = false; 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); }
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 Navigation_MarkupIsCorrect() { var controller = new NavigationFieldController(); var control = new MvcWidgetProxy(); control.ControllerName = typeof(NavigationFieldController).FullName; control.Settings = new ControllerSettings(controller); var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "NavigationFieldValueTest", "section-header-field-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId); var pageName = Res.Get <FieldResources>().PageName + "1"; Assert.IsTrue(pageContent.Contains(pageName), "Form did not render navigation field pages"); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
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.LimitCount = 5; dynamicController.Model.SortExpression = AsSetManuallySortingOption; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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_SetDetailTemplate() { 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); string detailNewsUrl = url + dynamicCollection[0].ItemDefaultUrl; string responseContent = PageInvoker.ExecuteWebRequest(detailNewsUrl); Assert.IsTrue(responseContent.Contains(paragraphText), "The paragraph text was not 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(fileDeatil); File.Delete(fileList); Directory.Delete(this.folderPath); this.pageOperations.DeletePages(); ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection); } }
public void ParagraphTextFieldTests_EditDefaultValue_MarkupIsCorrect() { const string DefaultText = "My default text"; var controller = new ParagraphTextFieldController(); controller.MetaField.DefaultValue = DefaultText; var control = new MvcWidgetProxy(); control.Settings = new ControllerSettings(controller); control.ControllerName = typeof(ParagraphTextFieldController).FullName; var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "ParagraphTextFieldSubmitValueTest", "paragraph-text-field-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId); Assert.IsTrue(pageContent.Contains(DefaultText), "Form did not render the default text in the paragraph text field."); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
private PageNode CreatePageWithCustomWidget() { var pageTitle = "TestPage1"; ServerOperations.Pages().CreatePage(pageTitle); var pageManager = PageManager.GetManager(); var pageNode = pageManager.GetPageNodes().SingleOrDefault(p => p.Title == pageTitle); var pageDraft = pageManager.EditPage(pageNode.PageId, CultureInfo.CurrentUICulture); var customWidget = new MvcWidgetProxy(); customWidget.ControllerName = typeof(TestController).FullName; customWidget.Settings = new ControllerSettings(new TestController()); customWidget.WidgetName = typeof(TestController).Name; var draftControlDefault = pageManager.CreateControl <PageDraftControl>(customWidget, "Body"); draftControlDefault.Caption = string.Empty; pageManager.SetControlDefaultPermissions(draftControlDefault); pageDraft.Controls.Add(draftControlDefault); pageManager.PublishPageDraft(pageDraft, CultureInfo.CurrentUICulture); pageManager.SaveChanges(); return(pageNode); }
private PageNode CreateBootstrapPageWithDynamicWidget() { Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName); var pageId = ServerOperations.Pages().CreatePage("TestPage1", templateId); var pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId); var pageManager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager(); var pageNode = pageManager.GetPageNode(pageNodeId); var pageDraft = pageManager.EditPage(pageNode.PageId, CultureInfo.CurrentUICulture); var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(DynamicContentController).FullName; var dynamicController = new DynamicContentController(); dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType); dynamicController.Model.SelectionMode = SelectionMode.AllItems; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; mvcProxy.Settings = new ControllerSettings(dynamicController); mvcProxy.WidgetName = WidgetName; var placeHoler = "Contentplaceholder1"; var draftControlDefault = pageManager.CreateControl <PageDraftControl>(mvcProxy, placeHoler); draftControlDefault.Caption = string.Empty; pageManager.SetControlDefaultPermissions(draftControlDefault); pageDraft.Controls.Add(draftControlDefault); pageManager.PublishPageDraft(pageDraft, CultureInfo.CurrentUICulture); pageManager.SaveChanges(); return(pageNode); }
private PageNode AddMixedWidgetsToPage(PageNode pageNode) { // Add MVC widget var pageManager = PageManager.GetManager(); var pageDraft = pageManager.EditPage(pageNode.PageId, CultureInfo.CurrentUICulture); var customWidget = new MvcWidgetProxy(); customWidget.ControllerName = typeof(TestController).FullName; customWidget.Settings = new ControllerSettings(new TestController()); customWidget.WidgetName = typeof(TestController).Name; var customWidgetDraft = pageManager.CreateControl <PageDraftControl>(customWidget, "Body"); customWidgetDraft.Caption = string.Empty; pageManager.SetControlDefaultPermissions(customWidgetDraft); pageDraft.Controls.Add(customWidgetDraft); pageManager.PublishPageDraft(pageDraft, CultureInfo.CurrentUICulture); pageManager.SaveChanges(); // Add WebForms widget ServerOperations.Widgets().AddContentBlockToPage(pageNode.Id, string.Empty, "Body", string.Empty); return(pageNode); }
public void DropdownListFieldTests_EditDefaultValue_MarkupIsCorrect() { var controller = new DropdownListFieldController(); var control = new MvcWidgetProxy(); control.Settings = new ControllerSettings(controller); control.ControllerName = typeof(DropdownListFieldController).FullName; var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "DropdownListFieldSubmitValueTest", "dropdown-list-field-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId); Assert.IsTrue(pageContent.Contains(Res.Get <FieldResources>().OptionSelect), "Form did not render the select default choice in the dropdown list field."); Assert.IsTrue(pageContent.Contains(Res.Get <FieldResources>().OptionFirstChoice), "Form did not render the first default choice in the dropdown list field."); Assert.IsTrue(pageContent.Contains(Res.Get <FieldResources>().OptionSecondChoice), "Form did not render the second default choice in the dropdown list field."); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
public void DynamicWidgetsDesignerListSettings_VerifySortLastModified() { string sortExpession = "LastModified DESC"; string newTitle = "Boat New Name"; var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles(); try { Guid boatItemId = Guid.Empty; for (int i = 0; i < this.dynamicTitles.Length; i++) { if (i == 1) { boatItemId = ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]).Id; } else { ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]); } } dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles().Where(item => item.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master).ToList(); var boatMasterItem = dynamicCollection.First(item => item.Id == boatItemId); ServerOperationsFeather.DynamicModulePressArticle().EditPressArticleTitle(boatMasterItem, newTitle); var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(DynamicContentController).FullName; var dynamicController = new DynamicContentController(); dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType); dynamicController.Model.SortExpression = sortExpession; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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 { dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles(); ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection); } }
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; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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_VerifyPublicationDateDescending() { string sortExpession = "PublicationDate DESC"; var publicationDates = new DateTime[this.dynamicTitles.Length]; for (int i = 0; i < this.dynamicTitles.Length; i++) { publicationDates[i] = new DateTime(2014, 9, 10, 12 - i, 00, 00); } var dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles(); try { for (int j = 0; j < this.dynamicTitles.Length; j++) { Guid itemId = ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[j], this.dynamicUrls[j]).Id; dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles(); var masterItem = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles().Where(item => item.Id == itemId && item.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master).First(); ServerOperationsFeather.DynamicModulePressArticle().PublishPressArticleWithSpecificDate(masterItem, publicationDates[j]); } var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(DynamicContentController).FullName; var dynamicController = new DynamicContentController(); dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType); dynamicController.Model.SortExpression = sortExpession; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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 MvcWidgetProxy CreateNewsMvcWidget() { var mvcWidget = new MvcWidgetProxy(); mvcWidget.ControllerName = typeof(NewsController).FullName; var newsController = new NewsController(); newsController.OpenInSamePage = true; mvcWidget.Settings = new ControllerSettings(newsController); return(mvcWidget); }
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; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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); } }
public void ParagraphTextField_SubmitValue_ResponseIsCorrect() { const string SubmitedParagraphValue = "Submitted paragraph value"; var controller = new ParagraphTextFieldController(); var control = new MvcWidgetProxy(); control.Settings = new ControllerSettings(controller); control.ControllerName = typeof(ParagraphTextFieldController).FullName; var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var formManager = FormsManager.GetManager(); var form = formManager.GetForms().FirstOrDefault(f => f.Id == formId); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "ParagraphTextFieldValueTest", "paragraph-text-field-submit-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageDataId = pageManager.GetPageNode(pageId).GetPageData().Id; var paragraphTextFieldControlData = form.Controls.Where(c => c.PlaceHolder == "Body" && !c.IsLayoutControl).FirstOrDefault(); var mvcFieldProxy = formManager.LoadControl(paragraphTextFieldControlData) as MvcWidgetProxy; var paragraphTextField = mvcFieldProxy.Controller as ParagraphTextFieldController; Assert.IsNotNull(paragraphTextField, "The paragraph text field was not found."); var paragraphTextFieldName = paragraphTextField.MetaField.FieldName; var formCollection = new FormCollection(); formCollection.Add(paragraphTextFieldName, SubmitedParagraphValue); var formControllerProxy = pageManager.LoadPageControls <MvcControllerProxy>(pageDataId).Where(contr => contr.Controller.GetType() == typeof(FormController)).FirstOrDefault(); var formController = formControllerProxy.Controller as FormController; formController.ControllerContext = new ControllerContext(); formController.ControllerContext.HttpContext = new HttpContextWrapper(HttpContext.Current); formController.Index(formCollection); var formEntry = formManager.GetFormEntries(form).LastOrDefault(); Assert.IsNotNull(formEntry, "Form entry has not been submitted."); var submittedValue = formEntry.GetValue(paragraphTextFieldName) as string; Assert.AreEqual(SubmitedParagraphValue, submittedValue, "Form did not persisted the submitted paragraph text value correctly."); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
private MvcWidgetProxy CreateBreadcrumbMvcWidget() { var mvcWidget = new MvcWidgetProxy(); mvcWidget.ControllerName = typeof(BreadcrumbController).FullName; var breadcrumbController = new BreadcrumbController(); mvcWidget.Settings = new ControllerSettings(breadcrumbController); breadcrumbController.Model.AllowVirtualNodes = true; return(mvcWidget); }
public void ParagraphTextFieldUrl_SubmitIncorrectValue_ServerValidationFails() { var controller = new ParagraphTextFieldController(); controller.Model.ValidatorDefinition.Required = true; var control = new MvcWidgetProxy(); control.ControllerName = typeof(ParagraphTextFieldController).FullName; control.Settings = new ControllerSettings(controller); var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control); var formManager = FormsManager.GetManager(); var form = formManager.GetForms().FirstOrDefault(f => f.Id == formId); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "ParagraphTextFieldValidationTest", "paragraph-text-field-validation-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageDataId = pageManager.GetPageNode(pageId).GetPageData().Id; var paragraphTextFieldControlData = form.Controls.Where(c => c.PlaceHolder == "Body" && !c.IsLayoutControl).FirstOrDefault(); var mvcFieldProxy = formManager.LoadControl(paragraphTextFieldControlData) as MvcWidgetProxy; var paragraphTextField = mvcFieldProxy.Controller as ParagraphTextFieldController; Assert.IsNotNull(paragraphTextField, "The paragraph text field was not found."); var paragraphTextFieldName = paragraphTextField.MetaField.FieldName; var formCollection = new FormCollection(); formCollection.Add(paragraphTextFieldName, string.Empty); var formControllerProxy = pageManager.LoadPageControls <MvcControllerProxy>(pageDataId).Where(contr => contr.Controller.GetType() == typeof(FormController)).FirstOrDefault(); var formController = formControllerProxy.Controller as FormController; formController.ControllerContext = new ControllerContext(); formController.ControllerContext.HttpContext = new HttpContextWrapper(HttpContext.Current); formController.Index(formCollection); Assert.IsFalse((bool)formController.TempData["sfSubmitSuccess"], "The Submit result was not correct"); var formEntry = formManager.GetFormEntries(form).LastOrDefault(); Assert.IsNull(formEntry, "Form entry has been submitted even when the form is not valid."); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
public void PageBreak_HeaderAndFooterFieldsInitialized() { var controllerForBody = new PageBreakController(); var controlForBody = new MvcWidgetProxy(); controlForBody.ControllerName = typeof(PageBreakController).FullName; controlForBody.Settings = new ControllerSettings(controllerForBody); var controllerForHeader = new TextFieldController(); var controlForHeader = new MvcWidgetProxy(); controlForHeader.ControllerName = typeof(TextFieldController).FullName; controlForHeader.Settings = new ControllerSettings(controllerForHeader); var controllerForFooter = new ParagraphTextFieldController(); var controlForFooter = new MvcWidgetProxy(); controlForFooter.ControllerName = typeof(ParagraphTextFieldController).FullName; controlForFooter.Settings = new ControllerSettings(controllerForFooter); var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(new List <Control>() { controlForHeader }, new List <Control>() { controlForBody }, new List <Control>() { controlForFooter }, null); var pageManager = PageManager.GetManager(); try { var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default"); Assert.IsNotNull(template, "Template was not found"); var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "PageBreakValueTest", "section-header-field-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId); var formMultipageDecorator = ObjectFactory.Resolve <IFormMultipageDecorator>(); Assert.IsTrue(pageContent.Contains(formMultipageDecorator.SeparatorBegin), "Form did not render page separators"); Assert.IsTrue(pageContent.Contains("data-sf-role=\"text-field-container\""), "Form did not render page header"); Assert.IsTrue(pageContent.Contains("data-sf-role=\"paragraph-text-field-container\""), "Form did not render page footer"); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
private void VerifyCorrectItemsOnPageWithNoLimitsOption(MvcWidgetProxy mvcProxy, string pageNamePrefix, string pageTitlePrefix, string urlNamePrefix, int index, string url, string[] selectedItemsTitles) { this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index); string responseContent = PageInvoker.ExecuteWebRequest(url); for (int i = 0; i < selectedItemsTitles.Count(); i++) { Assert.IsTrue(responseContent.Contains(selectedItemsTitles[i]), "The items with this title was not found!"); } this.pageOperations.DeletePages(); }
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; dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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); } }
private MvcWidgetProxy CreateDynamicMvcWidget() { var mvcWidget = new MvcWidgetProxy(); mvcWidget.ControllerName = typeof(DynamicContentController).FullName; var dynamicController = new DynamicContentController(); dynamicController.Model.ContentType = TypeResolutionService.ResolveType(ResolveType); dynamicController.Model.ProviderName = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; mvcWidget.Settings = new ControllerSettings(dynamicController); mvcWidget.WidgetName = WidgetName; return(mvcWidget); }
private MvcWidgetProxy CreateBlogsMvcWidget(ListDisplayMode displayMode, int itemsPerPage, string sortExpression) { var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(BlogController).FullName; var controller = new BlogController(); controller.Model.DisplayMode = displayMode; controller.Model.ItemsPerPage = itemsPerPage; controller.Model.SortExpression = sortExpression; mvcProxy.Settings = new ControllerSettings(controller); return(mvcProxy); }
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 = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName; 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); } }
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); } }
private MvcWidgetProxy CreateBlogsMvcWidgetFilteredSelectionMode(FilteredSelectionMode mode, int minPostsCount, int maxPostsAge) { var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(BlogController).FullName; var controller = new BlogController(); controller.Model.SelectionMode = SelectionMode.FilteredItems; controller.Model.FilteredSelectionMode = mode; controller.Model.MinPostsCount = minPostsCount; controller.Model.MaxPostsAge = maxPostsAge; mvcProxy.Settings = new ControllerSettings(controller); return(mvcProxy); }
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); }