Skip to content

feat: support multiple parameters in WithQuery#460

Merged
vbreuss merged 3 commits into
mainfrom
topic/add-isquery-with-multiple-parameters
Feb 6, 2026
Merged

feat: support multiple parameters in WithQuery#460
vbreuss merged 3 commits into
mainfrom
topic/add-isquery-with-multiple-parameters

Conversation

@vbreuss

@vbreuss vbreuss commented Feb 6, 2026

Copy link
Copy Markdown
Member

This PR adds support for multiple query parameters in the WithQuery method, enhancing the URI matching capabilities in Mockolate's web testing utilities. The previous implementation only supported pattern matching against the entire query string, while the new implementation allows precise matching of individual query parameters.

Key Changes:

  • Introduced HttpQueryParameterValue class to represent query parameter values
  • Added multiple overloads of WithQuery to support single parameters, multiple parameters, and query strings
  • Reorganized tests into separate files per method for better organization

@vbreuss vbreuss self-assigned this Feb 6, 2026
@vbreuss vbreuss added the enhancement New feature or request label Feb 6, 2026
Copilot AI review requested due to automatic review settings February 6, 2026 09:21
@github-actions

github-actions Bot commented Feb 6, 2026

Copy link
Copy Markdown

Test Results

    21 files  ± 0      21 suites  ±0   6m 22s ⏱️ +51s
 2 547 tests +13   2 546 ✅ +13  1 💤 ±0  0 ❌ ±0 
17 094 runs  +91  17 093 ✅ +91  1 💤 ±0  0 ❌ ±0 

Results for commit 2df3636. ± Comparison against base commit c9b806b.

This pull request removes 25 and adds 38 tests. Note that renamed tests count towards both.
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ ForHttp_ShouldVerifyHttpScheme(uri: "HTTP://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ ForHttp_ShouldVerifyHttpScheme(uri: "http://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ ForHttp_ShouldVerifyHttpScheme(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: False)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ ForHttps_ShouldVerifyHttpsScheme(uri: "HTTPS://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ ForHttps_ShouldVerifyHttpsScheme(uri: "http://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: False)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ ForHttps_ShouldVerifyHttpsScheme(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ WithHost_ShouldVerifyHost(uri: "http://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "mockolate.com", expectMatch: False)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ WithHost_ShouldVerifyHost(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "*aweXpect*", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ WithHost_ShouldVerifyHost(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "*awexpect*", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests ‑ WithHost_ShouldVerifyHost(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "www.awexpect.com", expectMatch: True)
…
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+ForHttpAndHttpsTests ‑ ForHttp_ShouldVerifyHttpScheme(uri: "HTTP://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+ForHttpAndHttpsTests ‑ ForHttp_ShouldVerifyHttpScheme(uri: "http://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+ForHttpAndHttpsTests ‑ ForHttp_ShouldVerifyHttpScheme(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: False)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+ForHttpAndHttpsTests ‑ ForHttps_ShouldVerifyHttpsScheme(uri: "HTTPS://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+ForHttpAndHttpsTests ‑ ForHttps_ShouldVerifyHttpsScheme(uri: "http://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: False)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+ForHttpAndHttpsTests ‑ ForHttps_ShouldVerifyHttpsScheme(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+WithHostTests ‑ ShouldVerifyHost(uri: "http://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "mockolate.com", expectMatch: False)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+WithHostTests ‑ ShouldVerifyHost(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "*aweXpect*", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+WithHostTests ‑ ShouldVerifyHost(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "*awexpect*", expectMatch: True)
Mockolate.Tests.Web.ItExtensionsTests+IsUriTests+WithHostTests ‑ ShouldVerifyHost(uri: "https://www.aweXpect.com/foo/bar?x=123&y=234", hostPattern: "www.awexpect.com", expectMatch: True)
…

♻️ This comment has been updated with latest results.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for multiple query parameters in the WithQuery method, enhancing the URI matching capabilities in Mockolate's web testing utilities. The previous implementation only supported pattern matching against the entire query string, while the new implementation allows precise matching of individual query parameters.

Changes:

  • Introduced HttpQueryParameterValue class to represent query parameter values
  • Added multiple overloads of WithQuery to support single parameters, multiple parameters, and query strings
  • Reorganized tests into separate files per method for better organization

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Source/Mockolate/Web/HttpQueryParameterValue.cs New class for representing HTTP query parameter values with matching logic
Source/Mockolate/Web/ItExtensions.Uri.cs Added three overloads of WithQuery method and updated implementation to use HttpQueryMatcher
Source/Mockolate/Web/ItExtensions.cs Introduced HttpQueryMatcher class for parsing and matching query parameters
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.cs Removed test methods and changed class to partial to support test reorganization
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithQueryTests.cs New test file containing query parameter matching tests
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPortTests.cs New test file containing port matching tests
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithPathTests.cs New test file containing path matching tests
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.WithHostTests.cs New test file containing host matching tests
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ForHttpsTests.cs New test file containing HTTP/HTTPS scheme tests
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt Updated API surface to reflect new HttpQueryParameterValue class and WithQuery overloads
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Updated API surface for .NET 8.0 target
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Updated API surface for .NET 10.0 target

Comment thread Source/Mockolate/Web/HttpQueryParameterValue.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.Uri.cs
@vbreuss vbreuss force-pushed the topic/add-isquery-with-multiple-parameters branch from d2ecf25 to 59f6cae Compare February 6, 2026 09:23
@github-actions

github-actions Bot commented Feb 6, 2026

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.82GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.102
[Host] : .NET 10.0.2 (10.0.2, 10.0.225.61305), X64 RyuJIT x86-64-v3

Job=InProcess Toolchain=InProcessEmitToolchain IterationCount=15
LaunchCount=1 WarmupCount=10

Method Mean Error StdDev Gen0 Gen1 Allocated
Simple_Mockolate 1.656 μs 0.0186 μs 0.0165 μs 0.2270 - 3.73 KB
Simple_Moq 178.411 μs 2.1914 μs 2.0498 μs 0.4883 - 14.55 KB
Simple_NSubstitute 6.067 μs 0.0134 μs 0.0112 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.968 μs 0.1765 μs 0.1651 μs 0.4959 - 8.11 KB

Copilot AI review requested due to automatic review settings February 6, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread Tests/Mockolate.Tests/Web/ItExtensionsTests.IsUriTests.ForHttpsTests.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.cs
@vbreuss vbreuss enabled auto-merge (squash) February 6, 2026 09:36
@sonarqubecloud

sonarqubecloud Bot commented Feb 6, 2026

Copy link
Copy Markdown

@vbreuss vbreuss merged commit 9798852 into main Feb 6, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/add-isquery-with-multiple-parameters branch February 6, 2026 09:41
@github-actions

github-actions Bot commented Feb 7, 2026

Copy link
Copy Markdown

This is addressed in release v1.3.0.

@github-actions github-actions Bot added the state: released The issue is released label Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants