Example #1
0
        public void BasePage_ExtractWebPartPropertiesViaWebServicesFromPageTest()
        {
            string url = "/sites/teamsite/SitePages/WPP-2010-Quantum.aspx";

            //string url = "/pages/article-2010-custom.aspx";

            using (var context = TestCommon.CreateOnPremisesClientContext(TestCommon.AppSetting("SPOnPremTeamSiteUrl")))
            {
                var pages = context.Web.GetPages("WPP-2010-Quantum");

                pages.FailTestIfZero();

                foreach (var page in pages)
                {
                    page.EnsureProperty(p => p.File);

                    List <string> search = new List <string>()
                    {
                        "WebPartZone"
                    };

                    //Should be one
                    TestBasePage testBase = new TestBasePage(page, page.File, null, null);
                    var          result   = testBase.ExtractWebPartPropertiesViaWebServicesFromPage(url);

                    Assert.IsTrue(result.Length > 0);

                    break;
                }
            }
        }
Example #2
0
        public void BasePage_LoadWebPartPropertiesViaWebServicesTest()
        {
            string url = "/sites/teamsite/SitePages/WPP-2010-Quantum.aspx";

            using (var context = TestCommon.CreateOnPremisesClientContext(TestCommon.AppSetting("SPOnPremTeamSiteUrl")))
            {
                var pages = context.Web.GetPages("WPP-2010-Quantum");

                pages.FailTestIfZero();

                foreach (var page in pages)
                {
                    page.EnsureProperty(p => p.File);

                    List <string> search = new List <string>()
                    {
                        "WebPartZone"
                    };

                    //Should be one
                    TestBasePage testBase = new TestBasePage(page, page.File, null, null);
                    var          result   = testBase.LoadWebPartPropertiesFromWebServices(url);

                    break;
                    //TODO: Finish Test
                }
            }
        }
        public void BasePage_LoadWebPartDocumentViaWebServicesTest()
        {
            //string url = "http://portal2010/pages/article-2010-custom.aspx";
            //string url = "/pages/article-2010-custom.aspx";
            //string url = "/pages/article-2010-custom.aspx";
            string url = "/pages/welcome-2013.aspx";

            using (var context = TestCommon.CreateOnPremisesClientContext())
            {
                var pages = context.Web.GetPagesFromList("Pages", "Article-2010-Custom-Test2");

                foreach (var page in pages)
                {
                    page.EnsureProperty(p => p.File);

                    List <string> search = new List <string>()
                    {
                        "WebPartZone"
                    };

                    //Should be one
                    TestBasePage testBase = new TestBasePage(page, page.File, null, null);
                    var          result   = testBase.LoadPublishingPageFromWebServices(url);

                    Assert.IsTrue(result.Count > 0);
                }
            }
        }
        public void BasePage_ExportWebPartByWorkaround()
        {
            //string url = "http://portal2010/pages/article-2010-custom.aspx";
            string url = "/pages/article-2010-custom-test2.aspx";

            //string url = "/pages/article-2010-custom.aspx";

            using (var context = TestCommon.CreateOnPremisesClientContext())
            {
                var pages = context.Web.GetPagesFromList("Pages", "Article-2010-Custom-Test2");

                foreach (var page in pages)
                {
                    page.EnsureProperty(p => p.File);

                    //Should be one
                    TestBasePage testBase        = new TestBasePage(page, page.File, null, null);
                    var          webPartEntities = testBase.LoadPublishingPageFromWebServices(url);

                    foreach (var webPart in webPartEntities)
                    {
                        var result = testBase.ExportWebPartXmlWorkaround(url, webPart.Id.ToString());

                        Assert.IsTrue(!string.IsNullOrEmpty(result));
                    }
                }
            }
        }
        public void BasePage_ExtractWebPartDocumentViaWebServicesFromPageTest()
        {
            string url = "http://portal2010/pages/article-2010-custom.aspx";

            //string url = "/pages/article-2010-custom.aspx";

            using (var context = TestCommon.CreateOnPremisesClientContext())
            {
                var pages = context.Web.GetPagesFromList("Pages", "Article-2010-Custom");

                foreach (var page in pages)
                {
                    page.EnsureProperty(p => p.File);

                    List <string> search = new List <string>()
                    {
                        "WebPartZone"
                    };

                    //Should be one
                    TestBasePage testBase = new TestBasePage(page, page.File, null, null);
                    var          result   = testBase.ExtractWebPartDocumentViaWebServicesFromPage(url);

                    Assert.IsTrue(result.Item1.Length > 0);
                    Assert.IsTrue(result.Item2.Length > 0);

                    break;
                }
            }
        }