Rewrite AcceptanceTests to use JSON files and JsonNode.DeepEquals#4
Merged
sander1095 merged 2 commits intofix/minimal-api-openapi-empty-pathsfrom Feb 28, 2026
Merged
Conversation
Replace manual parameter checks in minimal_api and mixed_api tests with JsonNode.DeepEquals comparison against expected JSON content files. Add v1-minimal.json and v1-mixed.json expected output files. Co-authored-by: sander1095 <7312681+sander1095@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor test code for improved setup using JSON files
Rewrite AcceptanceTests to use JSON files and JsonNode.DeepEquals
Feb 28, 2026
Owner
|
@copilot Please create a new issue at dotnet/aspnet-api-versioning for this culture issues. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrite AcceptanceTests to use JSON files and JsonNode.DeepEquals
Replace inline parameter-checking assertions with
JsonNode.DeepEqualsagainst expected JSON files.Description
The
minimal_apiandmixed_apiacceptance tests used manual assertions (checking path keys, parameter names, version strings). This is fragile and harder to maintain than comparing against a known-good document.All three acceptance tests now use the same pattern:
Changes:
AcceptanceTest.cs— replaced inline assertions inminimal_apiandmixed_apitests withJsonNode.DeepEqualsfile comparisons; removed unnecessaryAddProblemDetails()from the minimal API testContent/v1-minimal.json— expected OpenAPI document for the pure minimal API scenarioContent/v1-mixed.json— expected OpenAPI document for the controller + minimal API scenarioNote: The existing
v1.jsonwas not modified. Thecontroller_should_generate_expected_open_api_documenttest has a pre-existing failure due to culture-dependent date formatting (1/1/2026vs01/01/2026) and line ending differences inv1.json.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.