diff --git a/src/Microsoft.AspNetCore.JsonPatch/JsonPatchDocumentOfT.cs b/src/Microsoft.AspNetCore.JsonPatch/JsonPatchDocumentOfT.cs index 33e1e5033f..5b9df2b52b 100644 --- a/src/Microsoft.AspNetCore.JsonPatch/JsonPatchDocumentOfT.cs +++ b/src/Microsoft.AspNetCore.JsonPatch/JsonPatchDocumentOfT.cs @@ -691,12 +691,13 @@ namespace Microsoft.AspNetCore.JsonPatch { foreach (var op in Operations) { - var untypedOp = new Operation(); - - untypedOp.op = op.op; - untypedOp.value = op.value; - untypedOp.path = op.path; - untypedOp.from = op.from; + var untypedOp = new Operation + { + op = op.op, + value = op.value, + path = op.path, + from = op.from + }; allOps.Add(untypedOp); } @@ -715,11 +716,11 @@ namespace Microsoft.AspNetCore.JsonPatch path += "/" + position; if (segments.Count == 0) { - return path.ToLowerInvariant(); + return path; } } - return "/" + path.ToLowerInvariant(); + return "/" + path; } private List GetPathSegments(Expression expr) diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentGetPathTest.cs b/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentGetPathTest.cs index dcde4b442d..7d3331231c 100644 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentGetPathTest.cs +++ b/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentGetPathTest.cs @@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.JsonPatch var path = patchDocument.GetPath(p => p.SimpleObject.IntegerList, "-"); // Assert - Assert.Equal("/simpleobject/integerlist/-", path); + Assert.Equal("/SimpleObject/IntegerList/-", path); } [Fact] @@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.JsonPatch var path = patchDocument.GetPath(p => (BaseClass)p.DerivedObject, null); // Assert - Assert.Equal("/derivedobject", path); + Assert.Equal("/DerivedObject", path); } [Fact] diff --git a/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentJsonPropertyAttributeTest.cs b/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentJsonPropertyAttributeTest.cs index 50ab6a9f5b..882e09ffe7 100644 --- a/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentJsonPropertyAttributeTest.cs +++ b/test/Microsoft.AspNetCore.JsonPatch.Test/JsonPatchDocumentJsonPropertyAttributeTest.cs @@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.JsonPatch // get path var pathToCheck = deserialized.Operations.First().path; - Assert.Equal("/anothername", pathToCheck); + Assert.Equal("/AnotherName", pathToCheck); } [Fact] @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.JsonPatch // Assert var pathToCheck = deserialized.Operations.First().path; - Assert.Equal("/stringproperty", pathToCheck); + Assert.Equal("/StringProperty", pathToCheck); } [Fact] @@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.JsonPatch // Assert var pathToCheck = deserialized.Operations.First().path; - Assert.Equal("/arrayproperty/-", pathToCheck); + Assert.Equal("/ArrayProperty/-", pathToCheck); } [Fact] @@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.JsonPatch // get path var pathToCheck = deserialized.Operations.First().path; - Assert.Equal("/anothername", pathToCheck); + Assert.Equal("/AnotherName", pathToCheck); } [Fact] @@ -249,9 +249,9 @@ namespace Microsoft.AspNetCore.JsonPatch // Assert var fromPath = deserialized.Operations.First().from; - Assert.Equal("/stringproperty", fromPath); + Assert.Equal("/StringProperty", fromPath); var toPath = deserialized.Operations.First().path; - Assert.Equal("/stringproperty2", toPath); + Assert.Equal("/StringProperty2", toPath); } [Fact] @@ -269,7 +269,7 @@ namespace Microsoft.AspNetCore.JsonPatch // Assert var path = deserialized.Operations.First().path; - Assert.Equal("/socialsecuritynumber", path); + Assert.Equal("/SocialSecurityNumber", path); } private class JsonPropertyWithNoPropertyName