Skip to content

Commit

Permalink
Add comments for tricky tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
annelo-msft committed Feb 17, 2023
1 parent 9b6dde1 commit c2467b2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sdk/core/Azure.Core.Experimental/tests/DynamicJsonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ public void CanSetCamelCasePascalGetters()
Assert.AreEqual(3, (int)dynamicJson.bar);
Assert.AreEqual(3, (int)dynamicJson.Bar);

// PascalCase getters find camelCase properties and sets them.
dynamicJson.Foo = 4;
dynamicJson.Bar = 5;

Expand Down Expand Up @@ -588,6 +589,7 @@ public void CanSetCamelCasePascalGettersCamelSetters()
Assert.AreEqual(3, (int)dynamicJson.bar);
Assert.AreEqual(3, (int)dynamicJson.Bar);

// PascalCase getters find camelCase properties and sets them.
dynamicJson.Foo = 4;
dynamicJson.Bar = 5;

Expand All @@ -613,7 +615,7 @@ public void CanSetPascalCaseNoMapping()
};
dynamic dynamicJson = new BinaryData(json).ToDynamic(options);

// Existing property access
// This adds a new property, since it doesn't find `Foo`.
dynamicJson.foo = 2;

// New property access
Expand All @@ -624,7 +626,10 @@ public void CanSetPascalCaseNoMapping()
Assert.AreEqual(3, (int)dynamicJson.bar);
Assert.AreEqual(null, dynamicJson.Bar);

// This updates the PascalCase property and not the camelCase one.
dynamicJson.Foo = 4;

// This creates a new PascalCase property.
dynamicJson.Bar = 5;

Assert.AreEqual(2, (int)dynamicJson.foo);
Expand Down Expand Up @@ -655,9 +660,10 @@ public void CanSetPascalCasePascalGetters()
Assert.AreEqual(3, (int)dynamicJson.bar);
Assert.AreEqual(3, (int)dynamicJson.Bar);

// This updates the PascalCase property and not the camelCase one.
dynamicJson.Foo = 4;

// This property exists now as `bar`, so it updates the camelCase property.
// The PascalCase getter finds `bar`, so it updates the camelCase property.
dynamicJson.Bar = 5;

// New property is created as PascalCase
Expand All @@ -678,7 +684,7 @@ public void CanSetPascalCasePascalGettersCamelSetters()

dynamic dynamicJson = new BinaryData(json).ToDynamic();

// Existing property access
// Existing property access does not add a camelCase property.
dynamicJson.Foo = 2;

// New property is created as camelCase
Expand Down

0 comments on commit c2467b2

Please sign in to comment.