/// <summary> /// Export workaround tests /// </summary> /// <param name="version"></param> /// <param name="pageNameStartsWith"></param> private void ExportWebPartByWorkaround(SPPlatformVersion version, string pageNameStartsWith = "Common") { using (var context = TestCommon.CreateSPPlatformClientContext(version, TransformType.PublishingPage)) { var pages = context.Web.GetPagesFromList("Pages", pageNameStartsWith); foreach (var page in pages) { page.EnsureProperties(p => p.File, p => p.File.ServerRelativeUrl); TestBasePage testBase = new TestBasePage(page, page.File, null, null); var webPartEntities = testBase.LoadPublishingPageFromWebServices(page.File.ServerRelativeUrl); foreach (var webPart in webPartEntities) { var result = testBase.ExportWebPartXmlWorkaround(page.File.ServerRelativeUrl, webPart.Id.ToString()); Assert.IsTrue(!string.IsNullOrEmpty(result)); } } } }
/// <summary> /// Standard Load Web Part Document with Web Services Test /// </summary> /// <param name="version"></param> /// <param name="pageNameStartsWith"></param> private void LoadWebPartDocumentViaWebServicesTest(SPPlatformVersion version, string pageNameStartsWith = "Common") { using (var context = TestCommon.CreateSPPlatformClientContext(version, TransformType.PublishingPage)) { var pages = context.Web.GetPagesFromList("Pages", pageNameStartsWith); foreach (var page in pages) { page.EnsureProperties(p => p.File, p => p.File.ServerRelativeUrl); List <string> search = new List <string>() { "WebPartZone" }; //Should be one TestBasePage testBase = new TestBasePage(page, page.File, null, null); var result = testBase.LoadPublishingPageFromWebServices(page.File.ServerRelativeUrl); Assert.IsTrue(result.Count > 0); } } }