public void Recaptcha_MarkupIsCorrect() { var controller = new RecaptchaController(); var control = new MvcWidgetProxy(); control.ControllerName = typeof(RecaptchaController).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, "RecaptchaFieldValueTest", "recaptcha-field-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = FeatherServerOperations.Pages().GetPageContent(pageId); Assert.IsNotNull(pageContent.Contains("g-recaptcha"), "Form did not render recaptcha"); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
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 = FeatherServerOperations.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); } }
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 = FeatherServerOperations.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 DropdownListFieldTests_SubmitIncorrectValue_ServerValidationFails() { var controller = new DropdownListFieldController(); controller.Model.ValidatorDefinition.Required = true; var control = new MvcWidgetProxy(); control.ControllerName = typeof(DropdownListFieldController).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, "DropdownListFieldValidationTest", "dropdown-list-field-validation-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageDataId = pageManager.GetPageNode(pageId).GetPageData().Id; var dropdownListFieldControlData = form.Controls.Where(c => c.PlaceHolder == "Body" && !c.IsLayoutControl).FirstOrDefault(); var mvcFieldProxy = formManager.LoadControl(dropdownListFieldControlData) as MvcWidgetProxy; var dropdownListField = mvcFieldProxy.Controller as DropdownListFieldController; Assert.IsNotNull(dropdownListField, "The dropdown list field was not found."); var dropdownListFieldName = dropdownListField.MetaField.FieldName; var formCollection = new FormCollection(); formCollection.Add(dropdownListFieldName, 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 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 FlatTaxonomy_ContentId_BaseUrl() { this.CreateTestData(); var index = 1; var filterPageName = "filterPage"; var filterPageUrl = "filter-page"; var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName; var flatTaxonomyController = new FlatTaxonomyController(); flatTaxonomyController.Model.TaxaToDisplay = FlatTaxaToDisplay.UsedByContentType; flatTaxonomyController.Model.ContentTypeName = "Telerik.Sitefinity.News.Model.NewsItem"; flatTaxonomyController.Model.ContentId = this.newsIds[0]; // news1 id flatTaxonomyController.Model.BaseUrl = "~/" + filterPageUrl; mvcProxy.Settings = new ControllerSettings(flatTaxonomyController); this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index); this.serverPagesOperations.CreatePage(filterPageName, filterPageUrl); string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index); string responseContent = PageInvoker.ExecuteWebRequest(url); Assert.IsNotNull(responseContent); var urlPrefix = filterPageUrl + "/-in-tags/tags/"; var expectedTags = new List<Tag>() { new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2) }; var notExpectedTags = new List<Tag>() { new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1), new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 0), }; this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount); }
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 paragraphTextFieldName = ServerOperationsFeather.Forms().GetFirstFieldName(formManager, form); var result = ServerOperationsFeather.Forms().SubmitField(paragraphTextFieldName, string.Empty, pageManager, pageId); var contentResult = result as ContentResult; Assert.IsNotNull(contentResult, "Submit should return content result."); Assert.AreEqual(Res.Get<FormResources>().UnsuccessfullySubmittedMessage, contentResult.Content, "The Submit didn't result in error as expected!"); 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 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 CheckboxesFieldTests_EditDefaultChoices_MarkupIsCorrect() { var choice1 = "Choice1"; var choice2 = "Choice2"; var choice3 = "Choice3"; var controller = new CheckboxesFieldController(); controller.Model.SerializedChoices = "[\"{0}\",\"{1}\",\"{2}\"]".Arrange(choice1, choice2, choice3); controller.Model.HasOtherChoice = true; var control = new MvcWidgetProxy(); control.Settings = new ControllerSettings(controller); control.ControllerName = typeof(CheckboxesFieldController).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, "CheckboxesFieldDefaultValueTest", "checkboxes-field-value-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageContent = FeatherServerOperations.Pages().GetPageContent(pageId); Assert.IsTrue(pageContent.Contains(choice1), "Form did not render the first choice in the checkboxes field."); Assert.IsTrue(pageContent.Contains(choice2), "Form did not render the second choice in the checkboxes field."); Assert.IsTrue(pageContent.Contains(choice3), "Form did not render the third choice in the checkboxes field."); Assert.IsTrue(pageContent.Contains(Res.Get<FieldResources>().Other), "Form did not render the 'Other' choice in the checkboxes field."); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages(); FormsModuleCodeSnippets.DeleteForm(formId); } }
public void TextFieldUrl_SubmitIncorrectValue_ServerValidationFails() { 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.Url; 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, "TextFieldValidationTest", "text-field-validation-test"); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId); var pageDataId = pageManager.GetPageNode(pageId).GetPageData().Id; var textFieldName = this.GetTextFieldName(formManager, form); var formController = this.FindAndSubmitForm(pageManager, pageDataId, textFieldName); 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 FlatTaxonomy_SelectTagsByContentType_DynamicContentTypeName() { this.CreateTestData(); this.CreateDynamicContentTypeTestData(); var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName; var flatTaxonomyController = new FlatTaxonomyController(); flatTaxonomyController.Model.TaxaToDisplay = FlatTaxaToDisplay.UsedByContentType; flatTaxonomyController.Model.DynamicContentTypeName = "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle"; mvcProxy.Settings = new ControllerSettings(flatTaxonomyController); var index = 1; this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index); string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index); string responseContent = PageInvoker.ExecuteWebRequest(url); Assert.IsNotNull(responseContent); var urlPrefix = PageUrl + index + "/-in-tags/tags/"; var expectedTags = new List<Tag>() { // the count will show how many dynamic content items has assigned tag2 (not news) -> only one new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1), }; var notExpectedTags = new List<Tag>() { new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2), new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 1), }; this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount); }
public void FlatTaxonomy_SelectTags_ShowEmptyTags_SortManually() { this.CreateTestData(); var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName; var flatTaxonomyController = new FlatTaxonomyController(); flatTaxonomyController.Model.ShowEmptyTaxa = true; flatTaxonomyController.Model.TaxaToDisplay = FlatTaxaToDisplay.Selected; flatTaxonomyController.Model.SerializedSelectedTaxaIds = string.Format( CultureInfo.InvariantCulture, @"[""{0}"",""{1}""]", this.taxaIds[2], this.taxaIds[1]); flatTaxonomyController.Model.SortExpression = "AsSetManually"; mvcProxy.Settings = new ControllerSettings(flatTaxonomyController); var index = 1; this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index); string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index); string responseContent = PageInvoker.ExecuteWebRequest(url); Assert.IsNotNull(responseContent); var urlPrefix = PageUrl + index + "/-in-tags/tags/"; var expectedTags = new List<Tag>() { new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 0), new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1) }; var notExpectedTags = new List<Tag>() { new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2) }; this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount); }
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 paragraphTextFieldName = ServerOperationsFeather.Forms().GetFirstFieldName(formManager, form); ServerOperationsFeather.Forms().SubmitField(paragraphTextFieldName, SubmitedParagraphValue, pageManager, pageId); 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); } }
public void FlatTaxonomy_DefaultSettings() { this.CreateTestData(); var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(FlatTaxonomyController).FullName; var flatTaxonomyController = new FlatTaxonomyController(); mvcProxy.Settings = new ControllerSettings(flatTaxonomyController); var index = 1; this.pagesOperations.CreatePageWithControl(mvcProxy, PageName, PageName, PageUrl, index); string url = UrlPath.ResolveAbsoluteUrl("~/" + PageUrl + index); string responseContent = PageInvoker.ExecuteWebRequest(url); Assert.IsNotNull(responseContent); var urlPrefix = PageUrl + index + "/-in-tags/tags/"; var expectedTags = new List<Tag>() { new Tag(this.taxaNames[0], urlPrefix + this.taxaNames[0], 2), new Tag(this.taxaNames[1], urlPrefix + this.taxaNames[1], 1), }; var notExpectedTags = new List<Tag>() { new Tag(this.taxaNames[2], urlPrefix + this.taxaNames[2], 0), }; this.AssertTagsLinks(responseContent, expectedTags, notExpectedTags, flatTaxonomyController.Model.ShowItemCount); }
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); } }
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; }
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()); } }
private void VerifyCorrectItemsOnPageWithUseLimitsOption(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++) { if (i <= 4) { Assert.IsTrue(responseContent.Contains(selectedItemsTitles[i]), "The items with this title was not found!"); } else { Assert.IsFalse(responseContent.Contains(selectedItemsTitles[i]), "The items with this title was found!"); } } }
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); } }
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 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); } }
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; }
private MvcWidgetProxy CreateBlogsMvcWidgetSelectionMode(SelectionMode selectionMode, Guid selectedItemId) { var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(BlogController).FullName; var controller = new BlogController(); controller.Model.SelectionMode = selectionMode; if (selectedItemId != null) { controller.Model.SerializedSelectedItemsIds = "[" + selectedItemId.ToString() + "]"; } mvcProxy.Settings = new ControllerSettings(controller); return mvcProxy; }
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 FormsWidget_SubmitFormWithForumWidgetOnPageBasedOnCustomHybridPage_NoExceptionIsThrown() { var testName = MethodInfo.GetCurrentMethod().Name; var templateName = testName + "template"; var pageName = testName + "page"; var submitButtonControl = new MvcWidgetProxy(); submitButtonControl.ControllerName = typeof(SubmitButtonController).FullName; submitButtonControl.Settings = new ControllerSettings(new SubmitButtonController()); var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(submitButtonControl); var forumControl = new ForumsView(); var pageManager = PageManager.GetManager(); Guid templateId = Guid.Empty; Guid pageId = Guid.Empty; try { templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().CreateHybridMVCPageTemplate(templateName); pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(pageManager.GetTemplate(templateId), pageName, pageName); ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId, "TestForm", "Body"); PageContentGenerator.AddControlToPage(pageId, forumControl, "TestForum", "Body"); var page = pageManager.GetPageNode(pageId); var pageUrl = page.GetFullUrl(); pageUrl = RouteHelper.GetAbsoluteUrl(pageUrl); var webRequest = (HttpWebRequest)WebRequest.Create(pageUrl); var dataString = "------WebKitFormBoundaryPIB6p73K1Y0L0ha5--"; var dataBytes = (new ASCIIEncoding()).GetBytes(dataString); webRequest.Method = "POST"; webRequest.ContentLength = dataBytes.Length; webRequest.ContentType = "multipart/form-data"; webRequest.Timeout = 120 * 1000; webRequest.GetRequestStream().Write(dataBytes, 0, dataBytes.Length); Assert.DoesNotThrow(() => webRequest.GetResponse(), "Submitting a form on custom hybrid page with a forum widget on it throws error"); } finally { Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeletePage(pageId); Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().DeletePageTemplate(templateId); FormsModuleCodeSnippets.DeleteForm(formId); } }
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); } }
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 = FeatherServerOperations.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 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); } }
private MvcWidgetProxy CreateBlogPostsMvcWidget(Guid selectedParentId, ParentFilterMode parentMode, SelectionMode selectionMode, Guid selectedItemId) { var mvcProxy = new MvcWidgetProxy(); mvcProxy.ControllerName = typeof(BlogPostController).FullName; var controller = new BlogPostController(); controller.Model.ParentFilterMode = parentMode; controller.Model.SelectionMode = selectionMode; if (selectedParentId != null) { controller.Model.SerializedSelectedParentsIds = "[" + selectedParentId.ToString() + "]"; } if (selectedItemId != null) { controller.Model.SerializedSelectedItemsIds = "[" + selectedItemId.ToString() + "]"; } mvcProxy.Settings = new ControllerSettings(controller); return mvcProxy; }