public void CSOMApiCallBuilder_Test_BuildGetSitePropertiesRequestApiCall() { GetSitePropertiesRequest request = new GetSitePropertiesRequest(new Uri("https://bertonline.sharepoint.com/sites/removeme"), true); CSOMApiCallBuilder builder = new CSOMApiCallBuilder(); builder.AddRequest(request); string xmlBody = builder.SerializeCSOMRequests(); Assert.AreEqual(xmlBody, "<Request AddExpandoFieldTypeSuffix=\"true\" SchemaVersion=\"15.0.0.0\" LibraryVersion=\"16.0.0.0\" ApplicationName=\"pnp core sdk\" xmlns=\"http://schemas.microsoft.com/sharepoint/clientquery/2009\"><Actions><ObjectPath Id=\"4\" ObjectPathId=\"1\" /><ObjectPath Id=\"5\" ObjectPathId=\"3\" /><Query Id=\"2\" ObjectPathId=\"3\" ><Query SelectAllProperties=\"true\"><Properties /></Query></Query></Actions><ObjectPaths><Method Id=\"3\" ParentId=\"1\" Name=\"GetSitePropertiesByUrl\"><Parameters><Parameter Type=\"String\">https://bertonline.sharepoint.com/sites/removeme</Parameter><Parameter Type=\"Boolean\">true</Parameter></Parameters></Method><Constructor Id=\"1\" TypeId=\"{268004ae-ef6b-4e9b-8425-127220d84719}\" /></ObjectPaths></Request>"); }
public void CSOMApiCallBuilder_Test_BuildUpdateItemApiCall() { UpdateListItemRequest request = new UpdateListItemRequest("test-site-id", "test-web-id", "test-list-id", 1); request.FieldsToUpdate.Add( new CSOMItemField() { FieldName = "Test Field", FieldType = "String", FieldValue = "Test field value" }); CSOMApiCallBuilder builder = new CSOMApiCallBuilder(); builder.AddRequest(request); string xmlBody = builder.SerializeCSOMRequests(); Assert.AreEqual("<Request AddExpandoFieldTypeSuffix=\"true\" SchemaVersion=\"15.0.0.0\" LibraryVersion=\"16.0.0.0\" ApplicationName=\"pnp core sdk\" xmlns=\"http://schemas.microsoft.com/sharepoint/clientquery/2009\"><Actions><Method Name=\"SetFieldValue\" Id=\"4\" ObjectPathId=\"1\"><Parameters><Parameter Type=\"String\">Test Field</Parameter><Parameter Type=\"String\">Test field value</Parameter></Parameters></Method><Method Name=\"Update\" Id=\"5\" ObjectPathId=\"1\"></Method></Actions><ObjectPaths><Identity Id=\"1\" Name=\"121a659f-e03e-2000-4281-1212829d67dd|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:test-site-id:web:test-web-id:list:test-list-id:item:1,1\" /></ObjectPaths></Request>", xmlBody); }