Skip to content

Commit

Permalink
Copy over metadata selector when creating a copy of messagewritersett…
Browse files Browse the repository at this point in the history
…ing (#1541)

* Update ODataMessageWriterSettings.cs

* Add test case for copy constructor
  • Loading branch information
KanishManuja-MS authored Sep 17, 2019
1 parent c64b897 commit eb1a43f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Microsoft.OData.Core/ODataMessageWriterSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ private void CopyFrom(ODataMessageWriterSettings other)
this.useFormat = other.useFormat;
this.Version = other.Version;
this.LibraryCompatibility = other.LibraryCompatibility;
this.MetadataSelector = other.MetadataSelector;

this.validations = other.validations;
this.ThrowIfTypeConflictsWithMetadata = other.ThrowIfTypeConflictsWithMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using FluentAssertions;
using Microsoft.OData.UriParser;
using Microsoft.OData.Edm;
using Microsoft.OData.Evaluation;
using Xunit;
using ODataErrorStrings = Microsoft.OData.Strings;

Expand Down Expand Up @@ -288,6 +289,14 @@ public void CopyConstructorShouldCopyServiceDocument()
newSetting.MetadataDocumentUri.Should().Be(new Uri("http://test.org/$metadata"));
}

[Fact]
public void CopyConstructorShouldCopyMetadataSelector()
{
this.settings.MetadataSelector = new TestMetadataSelector() { PropertyToOmit = "TestProperty" };
var newSetting = this.settings.Clone();
(newSetting.MetadataSelector as TestMetadataSelector).PropertyToOmit.Should().Be("TestProperty");
}

[Fact]
public void CopyConstructorShouldCopyODataUri()
{
Expand Down

0 comments on commit eb1a43f

Please sign in to comment.