Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Features/JsonPatch/test/IntegrationTests/NestedObjectIntegrationTest.cs')
-rw-r--r--src/Features/JsonPatch/test/IntegrationTests/NestedObjectIntegrationTest.cs25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/Features/JsonPatch/test/IntegrationTests/NestedObjectIntegrationTest.cs b/src/Features/JsonPatch/test/IntegrationTests/NestedObjectIntegrationTest.cs
index 92c0e7fb2d..2a7d6f7cd2 100644
--- a/src/Features/JsonPatch/test/IntegrationTests/NestedObjectIntegrationTest.cs
+++ b/src/Features/JsonPatch/test/IntegrationTests/NestedObjectIntegrationTest.cs
@@ -175,7 +175,30 @@ namespace Microsoft.AspNetCore.JsonPatch.IntegrationTests
// Assert
Assert.Equal("A", targetObject.SimpleObject.AnotherStringProperty);
- }
+ }
+
+ [Fact]
+ public void CopyNullStringProperty_ToAnotherStringProperty()
+ {
+ // Arrange
+ var targetObject = new SimpleObjectWithNestedObject()
+ {
+ SimpleObject = new SimpleObject()
+ {
+ StringProperty = null,
+ AnotherStringProperty = "B"
+ }
+ };
+
+ var patchDocument = new JsonPatchDocument<SimpleObjectWithNestedObject>();
+ patchDocument.Copy(o => o.SimpleObject.StringProperty, o => o.SimpleObject.AnotherStringProperty);
+
+ // Act
+ patchDocument.ApplyTo(targetObject);
+
+ // Assert
+ Assert.Null(targetObject.SimpleObject.AnotherStringProperty);
+ }
[Fact]
public void Copy_DeepClonesObject()