Skip to content

Conversation

@olavloite
Copy link
Collaborator

Add some improvements to the .NET mock server. These features are used by the ADO.NET driver tests.

Add some improvements to the .NET mock server. These features are used by the ADO.NET driver tests.
@olavloite
Copy link
Collaborator Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several enhancements to the .NET mock server, such as configurable database dialects, waiting for specific requests, and handling larger messages. While these are valuable additions for testing, I've found a couple of high-severity issues related to performance and thread-safety in the new helper methods. I've also noted a minor issue with a magic number. My review includes specific code suggestions to address these points, aiming to improve the robustness and efficiency of the mock server.

{
// Setup a HTTP/2 endpoint without TLS.
options.Listen(endpoint, o => o.Protocols = HttpProtocols.Http2);
options.Limits.MaxRequestBodySize = 100_000_000;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The value 100_000_000 is used here as a magic number. To improve readability and maintainability, it's recommended to extract it into a named constant. You could define a private constant at the class level:

private const int MaxRequestBodySize = 100_000_000;

And then use it here:

options.Limits.MaxRequestBodySize = MaxRequestBodySize;

This makes the code more self-documenting and easier to manage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@olavloite olavloite force-pushed the dotnet-mock-server-improvements branch from 5b67fb5 to 031e53f Compare November 24, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant