本文整理汇总了C#中Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers.MvcWidgetProxy类的典型用法代码示例。如果您正苦于以下问题:C# MvcWidgetProxy类的具体用法?C# MvcWidgetProxy怎么用?C# MvcWidgetProxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MvcWidgetProxy类属于Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers命名空间,在下文中一共展示了MvcWidgetProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}