本文整理汇总了C#中MvcControllerProxy类的典型用法代码示例。如果您正苦于以下问题:C# MvcControllerProxy类的具体用法?C# MvcControllerProxy怎么用?C# MvcControllerProxy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MvcControllerProxy类属于命名空间,在下文中一共展示了MvcControllerProxy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewsWidget_OnBootstrapPageTemplate
public void NewsWidget_OnBootstrapPageTemplate()
{
string templateName = "Bootstrap.defaultNew3";
string placeHolder = "Contentplaceholder1";
string url = UrlPath.ResolveAbsoluteUrl("~/" + UrlNamePrefix);
Guid templateId = default(Guid);
try
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(NewsController).FullName;
var newsController = new NewsController();
mvcProxy.Settings = new ControllerSettings(newsController);
templateId = this.templateOperation.DuplicatePageTemplate(OldTemplateName, templateName);
this.templateOperation.AddControlToTemplate(templateId, mvcProxy, placeHolder, CaptionNews);
Guid pageId = this.locationGenerator.CreatePage(PageNamePrefix, PageTitlePrefix, UrlNamePrefix, null, null);
Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().SetTemplateToPage(pageId, templateId);
Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.News().CreateNewsItem(NewsTitle);
string responseContent = PageInvoker.ExecuteWebRequest(url);
Assert.IsTrue(responseContent.Contains(NewsTitle), "The news with this title was not found!");
}
finally
{
Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().DeletePageTemplate(templateId);
}
}
示例2: StyleSheetWidget_RendersInHead
public void StyleSheetWidget_RendersInHead()
{
var testName = MethodInfo.GetCurrentMethod().Name;
string pageNamePrefix = testName;
string pageTitlePrefix = testName;
string urlNamePrefix = testName;
string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix);
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(StyleSheetController).FullName;
var controller = new StyleSheetController();
controller.Model.Mode = ResourceMode.Reference;
controller.Model.ResourceUrl = "http://my-styles.com/styles.css";
controller.Model.MediaType = "screen";
mvcProxy.Settings = new ControllerSettings(controller);
using (var generator = new PageContentGenerator())
{
var pageId = generator.CreatePage(pageNamePrefix, pageTitlePrefix, urlNamePrefix);
PageContentGenerator.AddControlToPage(pageId, mvcProxy, "CSS widget");
string responseContent = PageInvoker.ExecuteWebRequest(url);
Assert.IsTrue(this.IsInHead(responseContent, @"<link href=""http://my-styles.com/styles.css"" media=""screen"" rel=""stylesheet"" type=""text/css"" />"), "The stylesheet reference was not found in the head.");
}
}
示例3: ContentBlockWidget_EditSharedContent
public void ContentBlockWidget_EditSharedContent()
{
string testName = "ContentBlockWidgetEditSharedContent";
string pageNamePrefix = testName + "ContentBlockPage";
string pageTitlePrefix = testName + "Content Block";
string urlNamePrefix = testName + "content-block";
int pageIndex = 1;
string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + pageIndex);
var content = App.WorkWith().ContentItems()
.Where(c => c.Title == ContentBlockTitle && c.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master)
.Get().Single();
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(ContentBlockController).FullName;
var contentBlockController = new ContentBlockController();
contentBlockController.SharedContentID = content.Id;
mvcProxy.Settings = new ControllerSettings(contentBlockController);
this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, pageIndex);
App.WorkWith().ContentItem(content.Id).CheckOut().Do(cI =>
{
cI.Content = ContentBlockContentEdited;
cI.LastModified = DateTime.UtcNow;
})
.CheckIn().Publish().SaveChanges();
string responseContent = PageInvoker.ExecuteWebRequest(url);
Assert.IsTrue(responseContent.Contains(ContentBlockContentEdited), "The content block with this title was not found!");
}
示例4: ContentBlockWidget_AdvancedSettings
public void ContentBlockWidget_AdvancedSettings()
{
string testName = "ContentBlockWidgetAdvancedSettings";
string pageNamePrefix = testName + "ContentBlockPage";
string pageTitlePrefix = testName + "Content Block";
string urlNamePrefix = testName + "content-block";
int pageIndex = 1;
string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + pageIndex);
var content = App.WorkWith().ContentItems()
.Published()
.Where(c => c.Title == ContentBlockTitle)
.Get().Single();
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(ContentBlockController).FullName;
var contentBlockController = new ContentBlockController();
contentBlockController.SharedContentID = content.Id;
mvcProxy.Settings = new ControllerSettings(contentBlockController);
this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, pageIndex);
string responseContent = PageInvoker.ExecuteWebRequest(url);
Assert.IsTrue(responseContent.Contains(ContentBlockContent), "The content block with this title was not found!");
}
示例5: AddFormControlToPage
public void AddFormControlToPage(Guid pageId, Guid formId, string formName = "TestForm", string placeholder = "Contentplaceholder1")
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(FormController).FullName;
var controller = new FormController();
controller.Model.FormId = formId;
controller.Model.ViewMode = FormViewMode.Write;
mvcProxy.Settings = new ControllerSettings(controller);
PageContentGenerator.AddControlToPage(pageId, mvcProxy, formName, placeholder);
}
示例6: Login_WithInstantLogin_VerifyLoginRedirectUrlIsCorrect
public void Login_WithInstantLogin_VerifyLoginRedirectUrlIsCorrect()
{
string loginStatusPageUrl = UrlPath.ResolveAbsoluteUrl("~/" + this.urlNamePrefix + this.pageIndex);
var absoluteUrl = UrlPath.GetDomainUrl() + "/Sitefinity/Authenticate/SWT";
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(LoginStatusController).FullName;
var loginStatusController = new LoginStatusController();
loginStatusController.Model.AllowWindowsStsLogin = true;
mvcProxy.Settings = new ControllerSettings(loginStatusController);
this.pageOperations.CreatePageWithControl(mvcProxy, this.pageNamePrefix, this.pageTitlePrefix, this.urlNamePrefix, this.pageIndex);
var responseContent = PageInvoker.ExecuteWebRequest(loginStatusPageUrl);
Assert.IsTrue(responseContent.Contains(this.GetExpectedUrlWithParams(absoluteUrl)), "Login redirect url is not as expected");
}
示例7: Login_RedirectToExternalPage_VerifyLoginRedirectUrlIsCorrect
public void Login_RedirectToExternalPage_VerifyLoginRedirectUrlIsCorrect()
{
string loginStatusPageUrl = UrlPath.ResolveAbsoluteUrl("~/" + this.urlNamePrefix + this.pageIndex);
string expectedLoginUrl = "www.telerik.com";
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(LoginStatusController).FullName;
var loginStatusController = new LoginStatusController();
loginStatusController.Model.ExternalLoginUrl = expectedLoginUrl;
mvcProxy.Settings = new ControllerSettings(loginStatusController);
this.pageOperations.CreatePageWithControl(mvcProxy, this.pageNamePrefix, this.pageTitlePrefix, this.urlNamePrefix, this.pageIndex);
var responseContent = PageInvoker.ExecuteWebRequest(loginStatusPageUrl);
Assert.IsTrue(responseContent.Contains(expectedLoginUrl), "Login redirect url is not as expected");
}
示例8: DocumentsList_VerifyLimit
public void DocumentsList_VerifyLimit()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(DocumentsListController).FullName;
var documentsListController = new DocumentsListController();
documentsListController.Model.SelectionMode = SelectionMode.AllItems;
documentsListController.Model.DisplayMode = ListDisplayMode.Limit;
documentsListController.Model.SortExpression = "Title ASC";
documentsListController.Model.ItemsPerPage = 1;
mvcProxy.Settings = new ControllerSettings(documentsListController);
var docs = documentsListController.Model.CreateListViewModel(null, 1).Items.ToArray();
Assert.IsTrue(docs.Length.Equals(1), "Number of docs is not correct");
Assert.AreEqual(DocumentTitle + 1, docs[0].Fields.Title.Value, "Wrong title");
}
示例9: UsersList_VerifyLimit
public void UsersList_VerifyLimit()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(UsersListController).FullName;
var usersListController = new UsersListController();
usersListController.Model.SelectionMode = SelectionMode.AllItems;
usersListController.Model.DisplayMode = ListDisplayMode.Limit;
usersListController.Model.SortExpression = "FirstName ASC";
usersListController.Model.ItemsPerPage = 1;
mvcProxy.Settings = new ControllerSettings(usersListController);
var users = usersListController.Model.CreateListViewModel(1).Items.ToArray();
Assert.IsTrue(users.Length.Equals(1), "Number of users is not correct");
Assert.AreEqual(SitefinityAdmin, users[0].Fields.User.UserName, "Wrong username");
}
示例10: VideoGallery_VerifyLimit
public void VideoGallery_VerifyLimit()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(VideoGalleryController).FullName;
var videoGalleryController = new VideoGalleryController();
videoGalleryController.Model.SelectionMode = SelectionMode.AllItems;
videoGalleryController.Model.DisplayMode = ListDisplayMode.Limit;
videoGalleryController.Model.SortExpression = "Title ASC";
videoGalleryController.Model.ItemsPerPage = 1;
mvcProxy.Settings = new ControllerSettings(videoGalleryController);
var videos = videoGalleryController.Model.CreateListViewModel(null, 1).Items.ToArray();
Assert.IsTrue(videos.Length.Equals(1), "Number of Videos is not correct");
Assert.AreEqual(VideoTitle + 1, videos[0].Fields.Title.Value, "Wrong title");
}
示例11: ResolveMvcDesigner
protected virtual MvcControllerProxy ResolveMvcDesigner(Type widgetType)
{
if (widgetType == null)
throw new ArgumentNullException("widgetType");
var store = PowerTools.Instance.Container.Resolve<IMvcDesignerStore>();
if (!store.MvcDesigners.ContainsKey(widgetType))
return null;
var designerControllerType = store.MvcDesigners[widgetType];
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = designerControllerType.FullName;
return mvcProxy;
}
示例12: DocumentsList_VerifySortingLastPublished
public void DocumentsList_VerifySortingLastPublished()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(DocumentsListController).FullName;
var documentsListController = new DocumentsListController();
documentsListController.Model.SelectionMode = SelectionMode.AllItems;
documentsListController.Model.SortExpression = "PublicationDate DESC";
mvcProxy.Settings = new ControllerSettings(documentsListController);
var docs = documentsListController.Model.CreateListViewModel(null, 1).Items.ToArray();
Assert.IsTrue(docs.Length.Equals(3), "Number of docs is not correct");
//// expected: Document2, Document3, Document1
Assert.AreEqual(DocumentTitle + 2, docs[0].Fields.Title.Value, "Wrong title");
Assert.AreEqual(DocumentTitle + 3, docs[1].Fields.Title.Value, "Wrong title");
Assert.AreEqual(DocumentTitle + 1, docs[2].Fields.Title.Value, "Wrong title");
}
示例13: UsersList_VerifySortingFirstNameAZ
public void UsersList_VerifySortingFirstNameAZ()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(UsersListController).FullName;
var usersListController = new UsersListController();
usersListController.Model.SelectionMode = SelectionMode.AllItems;
usersListController.Model.SortExpression = "FirstName ASC";
mvcProxy.Settings = new ControllerSettings(usersListController);
var users = usersListController.Model.CreateListViewModel(1).Items.ToArray();
Assert.IsTrue(users.Length.Equals(3), "Number of users is not correct");
//// expected: Admin Admin, fname lname, test last
Assert.AreEqual(SitefinityAdmin, users[0].Fields.User.UserName, "Wrong username");
Assert.AreEqual(AdministratorUserName, users[1].Fields.User.UserName, "Wrong username");
Assert.AreEqual(AuthorUserName, users[2].Fields.User.UserName, "Wrong username");
}
示例14: ImageGallery_VerifySortingLastPublished
public void ImageGallery_VerifySortingLastPublished()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(ImageGalleryController).FullName;
var imageGalleryController = new ImageGalleryController();
imageGalleryController.Model.SelectionMode = SelectionMode.AllItems;
imageGalleryController.Model.SortExpression = "PublicationDate DESC";
mvcProxy.Settings = new ControllerSettings(imageGalleryController);
var images = imageGalleryController.Model.CreateListViewModel(null, 1).Items.ToArray();
Assert.IsTrue(images.Length.Equals(3), "Number of images is not correct");
//// expected: Image2, Image3, Image1
Assert.AreEqual(ImageTitle + 2, images[0].Fields.Title.Value, "Wrong title");
Assert.AreEqual(ImageTitle + 3, images[1].Fields.Title.Value, "Wrong title");
Assert.AreEqual(ImageTitle + 1, images[2].Fields.Title.Value, "Wrong title");
}
示例15: ImageGallery_VerifyNoLimit
public void ImageGallery_VerifyNoLimit()
{
var mvcProxy = new MvcControllerProxy();
mvcProxy.ControllerName = typeof(ImageGalleryController).FullName;
var imageGalleryController = new ImageGalleryController();
imageGalleryController.Model.SelectionMode = SelectionMode.AllItems;
imageGalleryController.Model.DisplayMode = ListDisplayMode.All;
imageGalleryController.Model.SortExpression = "Title ASC";
imageGalleryController.Model.ItemsPerPage = 1;
mvcProxy.Settings = new ControllerSettings(imageGalleryController);
var images = imageGalleryController.Model.CreateListViewModel(null, 1).Items.ToArray();
Assert.IsTrue(images.Length.Equals(3), "Number of images is not correct");
Assert.AreEqual(ImagetTitle + 1, images[0].Fields.Title.Value, "Wrong title");
Assert.AreEqual(ImagetTitle + 2, images[1].Fields.Title.Value, "Wrong title");
Assert.AreEqual(ImagetTitle + 3, images[2].Fields.Title.Value, "Wrong title");
}