• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Controllers.MvcWidgetProxy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers.MvcWidgetProxy的典型用法代码示例。如果您正苦于以下问题:C# MvcWidgetProxy类的具体用法?C# MvcWidgetProxy怎么用?C# MvcWidgetProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MvcWidgetProxy类属于Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers命名空间,在下文中一共展示了MvcWidgetProxy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Recaptcha_MarkupIsCorrect

        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);
            }
        }
开发者ID:RichiL,项目名称:feather-widgets,代码行数:29,代码来源:RecaptchaTests.cs


示例2: ParagraphTextFieldTests_EditDefaultValue_MarkupIsCorrect

        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);
            }
        }
开发者ID:RJCuthbertson,项目名称:feather-widgets,代码行数:32,代码来源:ParagraphTextFieldTests.cs


示例3: DropdownListFieldTests_EditDefaultValue_MarkupIsCorrect

        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);
            }
        }
开发者ID:RJCuthbertson,项目名称:feather-widgets,代码行数:31,代码来源:DropdownListFieldTests.cs


示例4: DropdownListFieldTests_SubmitIncorrectValue_ServerValidationFails

        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);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:50,代码来源:DropdownListFieldTests.cs


示例5: DynamicWidgetsAllTypes_VerifyAllFieldsOnTheFrontendWhereSomeFieldsAreEmpty

        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);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:42,代码来源:DynamicWidgetsAllTypesTests.cs


示例6: DynamicWidgetsDesignerContent_VerifyAllFunctionality

        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);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:40,代码来源:DynamicWidgetsDesignerContentTests.cs


示例7: FlatTaxonomy_ContentId_BaseUrl

        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);
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:39,代码来源:FlatTaxonomyTests.cs


示例8: ParagraphTextFieldUrl_SubmitIncorrectValue_ServerValidationFails

        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);
            }
        }
开发者ID:RJCuthbertson,项目名称:feather-widgets,代码行数:39,代码来源:ParagraphTextFieldTests.cs


示例9: DynamicWidgetsPageTemplate_DynamicWidgetOnPageTemplate

        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);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:38,代码来源:DynamicWidgetsPageTemplateTests.cs


示例10: CheckboxesFieldTests_EditDefaultChoices_MarkupIsCorrect

        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);
            }
        }
开发者ID:RJCuthbertson,项目名称:feather-widgets,代码行数:38,代码来源:CheckboxesFieldTests.cs


示例11: TextFieldUrl_SubmitIncorrectValue_ServerValidationFails

        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);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:37,代码来源:TextFieldTests.cs


示例12: FlatTaxonomy_SelectTagsByContentType_DynamicContentTypeName

        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);
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:36,代码来源:FlatTaxonomyTests.cs


示例13: FlatTaxonomy_SelectTags_ShowEmptyTags_SortManually

        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);
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:40,代码来源:FlatTaxonomyTests.cs


示例14: ParagraphTextField_SubmitValue_ResponseIsCorrect

        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);
            }
        }
开发者ID:RJCuthbertson,项目名称:feather-widgets,代码行数:40,代码来源:ParagraphTextFieldTests.cs


示例15: FlatTaxonomy_DefaultSettings

        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);
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:32,代码来源:FlatTaxonomyTests.cs


示例16: AddDynamicWidgetToPage

        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);
            }
        }
开发者ID:tthiatma,项目名称:feather-widgets,代码行数:23,代码来源:PagesOperations.cs


示例17: CreateBlogsMvcWidgetFilteredSelectionMode

        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;
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:15,代码来源:BlogsWidgetTests.cs


示例18: DynamicWidgets_VerifySelectedItemsFunctionalityWithUseLimit

        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());
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:59,代码来源:DynamicWidgetsDesignerContentWithListSettingsTests.cs


示例19: VerifyCorrectItemsOnPageWithUseLimitsOption


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Mvc.GridCommand类代码示例发布时间:2022-05-26
下一篇:
C# JustMock.PrivateAccessor类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap