Is CSharpCodeMatcher actually usable? #706

Closed
opened 2025-12-29 15:31:29 +01:00 by adam · 1 comment
Owner

Originally created by @smfields on GitHub (Jul 23, 2025).

Originally assigned to: @StefH on GitHub.

The docs mention a CSharpCodeMatcher and show the following usage:

var server = WireMockServer.Start();
server
    .Given(Request.Create().WithPath("/cs")
        .WithParam("from", new CSharpCodeMatcher("return it == \"x\";")))
    .RespondWith(Response.Create()
        .WithBody("cs match")
    );

But CSharpCodeMatcher is an internal class, so it can't be new'd up directly like shown above. So how are you actually supposed to use it from code?

Originally created by @smfields on GitHub (Jul 23, 2025). Originally assigned to: @StefH on GitHub. The [docs](https://github.com/wiremock/WireMock.Net/wiki/Request-Matching-CSharpCode) mention a CSharpCodeMatcher and show the following usage: ```csharp var server = WireMockServer.Start(); server .Given(Request.Create().WithPath("/cs") .WithParam("from", new CSharpCodeMatcher("return it == \"x\";"))) .RespondWith(Response.Create() .WithBody("cs match") ); ``` But `CSharpCodeMatcher` is an internal class, so it can't be new'd up directly like shown above. So how are you actually supposed to use it from code?
adam added the bug label 2025-12-29 15:31:29 +01:00
adam closed this issue 2025-12-29 15:31:29 +01:00
Author
Owner

@StefH commented on GitHub (Jul 23, 2025):

This is indeed incorrectly designed, I'll fix it.

https://github.com/wiremock/WireMock.Net/pull/1337

@StefH commented on GitHub (Jul 23, 2025): This is indeed incorrectly designed, I'll fix it. https://github.com/wiremock/WireMock.Net/pull/1337
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#706