Ejemplo n.º 1
0
        public void BasePage_ExtractWebPartDocumentViaWebServicesFromWebPartPageTest()
        {
            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.ExtractWebPartDocumentViaWebServicesFromPage(url);

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

                    break;
                }
            }
        }
        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;
                }
            }
        }