Skip to content

Create new AssertContentsAgainstJsonNet to avoid calling NormalizeToJsonNetFormat when not necessary. #32351

@ahsonkhan

Description

@ahsonkhan

There are subtle differences between Newtonsoft.Json and S.T.Json on how characters are escaped (upper case hex digits vs lower case), etc. This requires helpers for testing. Capturing the TODO into an issue: dotnet/corefx#39900 (comment).

// Temporary hack until we can use the same escape algorithm on both sides and make sure we want uppercase hex.
// Todo: create new AssertContentsAgainJsonNet to avoid calling NormalizeToJsonNetFormat when not necessary.
Assert.Equal(expectedValue.NormalizeToJsonNetFormat(), value.NormalizeToJsonNetFormat());

// Temporary hack until we can use the same escape algorithm on both sides and make sure we want uppercase hex.
// Todo: create new AssertContentsNotEqualAgainJsonNet to avoid calling NormalizeToJsonNetFormat when not necessary.
Assert.NotEqual(expectedValue.NormalizeToJsonNetFormat(), value.NormalizeToJsonNetFormat());

cc @steveharter

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions