Skip to content

Commit

Permalink
add tests for optinoal property naming
Browse files Browse the repository at this point in the history
  • Loading branch information
gregsdennis committed Oct 28, 2023
1 parent 3c40653 commit 7752443
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions JsonPointer.Tests/ExpressionCreationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ public void SimpleProperty()
Assert.AreEqual(expected, actual.ToString());
}

public static IEnumerable<TestCaseData> NamingOptions
{
get
{
yield return new TestCaseData(PropertyNameResolvers.AsDeclared, "/NestMore");
yield return new TestCaseData(PropertyNameResolvers.CamelCase, "/nestMore");
yield return new TestCaseData(PropertyNameResolvers.KebabCase, "/nest-more");
yield return new TestCaseData(PropertyNameResolvers.PascalCase, "/NestMore");
yield return new TestCaseData(PropertyNameResolvers.SnakeCase, "/nest_more");
yield return new TestCaseData(PropertyNameResolvers.UpperKebabCase, "/NEST-MORE");
yield return new TestCaseData(PropertyNameResolvers.UpperSnakeCase, "/NEST_MORE");
}
}

[TestCaseSource(nameof(NamingOptions))]
public void SimplePropertyWithOptions(PropertyNameResolver resolver, string expected)
{
var actual = JsonPointer.Create<TestClass>(x => x.NestMore, new PointerCreationOptions { PropertyNameResolver = resolver });

Assert.AreEqual(expected, actual.ToString());
}

[Test]
public void JsonProperty()
{
Expand Down

0 comments on commit 7752443

Please sign in to comment.