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

C# MvcControllerProxy类代码示例

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

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



MvcControllerProxy类属于命名空间,在下文中一共展示了MvcControllerProxy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:31,代码来源:NewsWidgetPageTemplateTests.cs


示例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.");
            }
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:25,代码来源:StyleSheetWidgetTests.cs


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


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


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


示例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");
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:14,代码来源:LoginTests.cs


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


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


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


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


示例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;
        }
开发者ID:mcupryk,项目名称:PowerTools,代码行数:16,代码来源:ExtendedPropertyEditor.cs


示例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");
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:17,代码来源:DocumentsListWidgetSortingTests.cs


示例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");
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:17,代码来源:UsersListWidgetSortingTests.cs


示例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");
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:17,代码来源:ImageGalleryWidgetSortingTests.cs


示例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");
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:17,代码来源:ImageGalleryWidgetPagingLimitTests.cs


示例16: NewsWidget_SelectListTemplate

        public void NewsWidget_SelectListTemplate()
        {
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "NewsPage";
            string pageTitlePrefix = testName + "News Page";
            string urlNamePrefix = testName + "news-page";
            int pageIndex = 1;
            string textEdited = "<p> Test paragraph </p>";
            string paragraphText = "Test paragraph";
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + pageIndex);

            string listTemplate = "NewsListNew";
            var listTemplatePath = Path.Combine(this.templateOperation.SfPath, "ResourcePackages", "Bootstrap", "MVC", "Views", "News", "List.NewsList.cshtml");
            var newListTemplatePath = Path.Combine(this.templateOperation.SfPath, "MVC", "Views", "Shared", "List.NewsListNew.cshtml");

            try
            {
                File.Copy(listTemplatePath, newListTemplatePath);

                using (StreamWriter output = File.AppendText(newListTemplatePath))
                {
                    output.WriteLine(textEdited);
                }

                var mvcProxy = new MvcControllerProxy();
                mvcProxy.ControllerName = typeof(NewsController).FullName;
                var newsController = new NewsController();
                newsController.ListTemplateName = listTemplate;
                mvcProxy.Settings = new ControllerSettings(newsController);

                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.News().CreateNewsItem(NewsTitle);

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, pageIndex);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                Assert.IsTrue(responseContent.Contains(paragraphText), "The news with this template was not found!");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                File.Delete(newListTemplatePath);
            }
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:44,代码来源:NewsWidgetListSettingsTests.cs


示例17: NavigationWidgetOnPageTemplate_AllPagesUnderCurrentlyOpenedPage

        public void NavigationWidgetOnPageTemplate_AllPagesUnderCurrentlyOpenedPage()
        {
            Guid templateId = default(Guid);

            try
            {
                templateId = this.templateOperation.DuplicatePageTemplate(OldTemplateName, TemplateName1);

                string url = UrlPath.ResolveAbsoluteUrl("~/" + UrlNamePrefix);

                var mvcProxy = new MvcControllerProxy();
                mvcProxy.ControllerName = typeof(NavigationController).FullName;
                var navigationController = new NavigationController();
                navigationController.TemplateName = "Horizontal";
                navigationController.SelectionMode = PageSelectionMode.CurrentPageChildren;
                mvcProxy.Settings = new ControllerSettings(navigationController);

                this.templateOperation.AddControlToTemplate(templateId, mvcProxy, PlaceHolder, CaptionNavigation);
                Guid pageId = this.locationGenerator.CreatePage(PageNamePrefix, PageTitlePrefix, UrlNamePrefix, null, null);
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().SetTemplateToPage(pageId, templateId);

                for (int i = 1; i <= 4; i++)
                {
                    Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(SiblingPage + i);
                    Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageTitlePrefix + i, Guid.NewGuid(), pageId);
                }

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                Assert.IsTrue(responseContent.Contains(Template), "The page template was not found!");

                for (int i = 1; i <= 4; i++)
                {
                    Assert.IsTrue(responseContent.Contains(PageTitlePrefix + i), "The page with this title was not found!");
                    Assert.IsFalse(responseContent.Contains(SiblingPage + i), "The page with this title was found!");
                }
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().DeletePageTemplate(templateId);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:43,代码来源:NavigationWidgetPageTemplateTests.cs


示例18: VideoGallery_VerifySortingLastModified

        public void VideoGallery_VerifySortingLastModified()
        {
            var mvcProxy = new MvcControllerProxy();
            mvcProxy.ControllerName = typeof(VideoGalleryController).FullName;
            var videoGalleryController = new VideoGalleryController();
            videoGalleryController.Model.SelectionMode = SelectionMode.AllItems;
            videoGalleryController.Model.SortExpression = "LastModified DESC";
            mvcProxy.Settings = new ControllerSettings(videoGalleryController);

            this.ChangeModifiedDateOfVideo3();

            var videos = videoGalleryController.Model.CreateListViewModel(null, 1).Items.ToArray();
            Assert.IsTrue(videos.Length.Equals(3), "Number of Videos is not correct");

            //// expected: Video31, Video2, Video1
            Assert.AreEqual(VideoTitle + 3 + 1, videos[0].Fields.Title.Value, "Wrong title");
            Assert.AreEqual(VideoTitle + 2, videos[1].Fields.Title.Value, "Wrong title");
            Assert.AreEqual(VideoTitle + 1, videos[2].Fields.Title.Value, "Wrong title");
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:19,代码来源:VideoGalleryWidgetSortingTests.cs


示例19: NewsWidget_SelectDetailTemplate

        public void NewsWidget_SelectDetailTemplate()
        {
            string testName = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix = testName + "NewsPage";
            string pageTitlePrefix = testName + "News Page";
            string urlNamePrefix = testName + "news-page";
            int pageIndex = 1;
            string textEdited = "<p> Test paragraph </p>";
            string paragraphText = "Test paragraph";
            var newsManager = NewsManager.GetManager();
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + pageIndex);

            string detailTemplate = "DetailPageNew";
            var detailTemplatePath = Path.Combine(this.templateOperation.SfPath, "ResourcePackages", "Bootstrap", "MVC", "Views", "News", "Detail.DetailPage.cshtml");
            var newDetailTemplatePath = Path.Combine(this.templateOperation.SfPath, "MVC", "Views", "Shared", "Detail.DetailPageNew.cshtml");

            try
            {
                File.Copy(detailTemplatePath, newDetailTemplatePath);
                this.EditFile(newDetailTemplatePath, textEdited);

                var mvcProxy = new MvcControllerProxy();
                mvcProxy.ControllerName = typeof(NewsController).FullName;
                var newsController = new NewsController();
                newsController.DetailTemplateName = detailTemplate;
                mvcProxy.Settings = new ControllerSettings(newsController);

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, pageIndex);

                NewsItem newsItem = newsManager.GetNewsItems().Where<NewsItem>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master && ni.Title == NewsTitleDetail).FirstOrDefault();
                string detailNewsUrl = url + newsItem.ItemDefaultUrl;

                string responseContent = PageInvoker.ExecuteWebRequest(detailNewsUrl);

                Assert.IsTrue(responseContent.Contains(NewsTitleDetail), "The news with this title was not found!");
                Assert.IsTrue(responseContent.Contains(paragraphText), "The news with this template was not found!");
            }
            finally
            {
                File.Delete(newDetailTemplatePath);
            }
        }
开发者ID:rhullah,项目名称:feather-widgets,代码行数:42,代码来源:NewsWidgetDetailTests.cs


示例20: ContentBlockWidget_AddTableToContentBlock

        public void ContentBlockWidget_AddTableToContentBlock()
        {
            string pageNamePrefix = "ContentBlockPage";
            string pageTitlePrefix = "Content Block";
            string urlNamePrefix = "content-block";
            int pageIndex = 1;
            string contentBlockContent = "<table><tbody><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></tbody></table>";
            string url = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + pageIndex);

            var mvcProxy = new MvcControllerProxy();
            mvcProxy.ControllerName = typeof(ContentBlockController).FullName;
            var contentBlockController = new ContentBlockController();
            contentBlockController.Content = contentBlockContent;
            mvcProxy.Settings = new ControllerSettings(contentBlockController);

            this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, pageIndex);
            string responseContent = PageInvoker.ExecuteWebRequest(url);

            Assert.IsTrue(responseContent.Contains(contentBlockContent), "Table was not found!");
        }
开发者ID:ParabolaSoftware,项目名称:feather-widgets,代码行数:20,代码来源:ContentBlockEditorTests.cs



注:本文中的MvcControllerProxy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MvcSiteMapHtmlHelper类代码示例发布时间:2022-05-24
下一篇:
C# MvcContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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