MarcosLopezC / LightJson

A simple JSON library for C#.
MIT License
60 stars 21 forks source link

JsonObject.Rename fails when old and new name are the same #32

Closed sharwell closed 7 years ago

sharwell commented 7 years ago

When the old and new keys are the same, JsonObject.Rename will remove the key rather than return without making changes.

var obj = new JsonObject { ["x"] = "value" };
obj.Rename("x", "x");
Assert.True(obj.ContainsKey("x")); // This currently fails

:link: This was originally found in DotNetAnalyzers/StyleCopAnalyzers#2406.

MarcosLopezC commented 7 years ago

This issue was fixed in commit ed5b767ab01fe719b733783493a6d77f79eb9b26.