Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ahsonkhan opened this issue Feb 15, 2020 · 0 comments · Fixed by #34931
Labels
area-System.Text.Json help wanted [up-for-grabs] Good issue for external contributors test-enhancement Improvements of test source code
Milestone

Comments

@ahsonkhan
Copy link
Contributor

ahsonkhan commented Feb 15, 2020

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

@ahsonkhan ahsonkhan added area-System.Text.Json test-enhancement Improvements of test source code labels Feb 15, 2020
@ahsonkhan ahsonkhan added this to the 5.0 milestone Feb 15, 2020
@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Feb 15, 2020
@ahsonkhan ahsonkhan removed the untriaged New issue has not been triaged by the area owner label Feb 15, 2020
@layomia layomia added the help wanted [up-for-grabs] Good issue for external contributors label Apr 7, 2020
marcusturewicz added a commit to marcusturewicz/runtime that referenced this issue Apr 14, 2020
layomia pushed a commit that referenced this issue Apr 15, 2020
* Adds AssertContentsAgainstJsonNet to avoid unnecessary calls

Fixes #32351

* Remove temporary hack comments
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Text.Json help wanted [up-for-grabs] Good issue for external contributors test-enhancement Improvements of test source code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants