Skip to content

Commit

Permalink
Fixing #47
Browse files Browse the repository at this point in the history
  • Loading branch information
skazantsev committed Feb 15, 2020
1 parent 862b15e commit 8c2c058
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
8 changes: 0 additions & 8 deletions src/WebDav.Client.Tests/Methods/ProppatchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ public async void When_SetProperties_Should_IncludeThemInSetTag()
<D:set>
<D:prop>
<prop1>value1</prop1>
</D:prop>
<D:prop>
<prop2>value2</prop2>
</D:prop>
</D:set>
Expand All @@ -118,8 +116,6 @@ public async void When_SetPropertiesWithNamespaces_Should_IncludeXmlnsTagAndUseP
<D:set>
<D:prop>
<X:prop1>value1</X:prop1>
</D:prop>
<D:prop>
<prop2>value2</prop2>
</D:prop>
</D:set>
Expand Down Expand Up @@ -151,8 +147,6 @@ public async void When_RemoveProperties_Should_IncludeThemInRemoveTag()
<D:remove>
<D:prop>
<prop1 />
</D:prop>
<D:prop>
<prop2 />
</D:prop>
</D:remove>
Expand All @@ -174,8 +168,6 @@ public async void When_RemovePropertiesWithNamespaces_Should_IncludeXmlnsTagAndU
<D:remove>
<D:prop>
<X:prop1 />
</D:prop>
<D:prop>
<prop2 />
</D:prop>
</D:remove>
Expand Down
10 changes: 6 additions & 4 deletions src/WebDav.Client/Request/ProppatchRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,26 @@ internal static class ProppatchRequestBuilder
if (propertiesToSet.Any())
{
var setEl = new XElement("{DAV:}set");
var propEl = new XElement("{DAV:}prop");
foreach (var prop in propertiesToSet)
{
var el = new XElement(prop.Key);
el.SetInnerXml(prop.Value);
setEl.Add(new XElement(XName.Get("prop", "DAV:"), el));
propEl.Add(el);
}
setEl.Add(propEl);
propertyupdate.Add(setEl);
}

if (propertiesToRemove.Any())
{
var removeEl = new XElement("{DAV:}remove");
var propEl = new XElement("{DAV:}prop");
foreach (var prop in propertiesToRemove)
{
removeEl.Add(
new XElement(XName.Get("prop", "DAV:"),
new XElement(prop)));
propEl.Add(new XElement(prop));
}
removeEl.Add(propEl);
propertyupdate.Add(removeEl);
}

Expand Down

0 comments on commit 8c2c058

Please sign in to comment.