mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 21:10:32 +01:00
MappingsToCSharpCode should use RegexMatcher when specified #621
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @carlin-q-scott on GitHub (Aug 5, 2024).
Originally assigned to: @StefH on GitHub.
Is your feature request related to a problem? Please describe.
I used the MappingsToCSharpCode on the WiremockServer class to get C# mappings for my json mocks and it did not respect the matchers. It assumed everything was an exact match.
My json defined mock:
The resulting CSharpCode:
Describe the solution you'd like
If the Matcher.Name is RegexMatcher, then create a RegexMatcher instead of directly passing the pattern to the RequestBuilder method.
Describe alternatives you've considered
Manually fixing the generated code.
Is your feature request supported by WireMock (java version)? Please provide details.
I don't think this relevant.
Additional context
Add any other context or screenshots about the feature request here.
@StefH commented on GitHub (Aug 5, 2024):
@carlin-q-scott
This is indeed invalid.
(ExactMatcher and LinqMatcher are also not correctly transformed)
However fixing this needs a complete rewrite from the generating logic...
(Currently the logic is defined in 1 class, but the knowledge about the parameters should be moved to the matcher itself...)
@StefH commented on GitHub (Aug 6, 2024):
https://github.com/WireMock-Net/WireMock.Net/pull/1152
@StefH commented on GitHub (Aug 6, 2024):
@carlin-q-scott
If you want, you can use preview 1.5.62-ci-19075 to test.