Skip to content

fix: enable validation when using form-data access#474

Merged
vbreuss merged 6 commits into
mainfrom
topic/fix-formdata
Feb 10, 2026
Merged

fix: enable validation when using form-data access#474
vbreuss merged 6 commits into
mainfrom
topic/fix-formdata

Conversation

@vbreuss

@vbreuss vbreuss commented Feb 9, 2026

Copy link
Copy Markdown
Member

Refactors ItExtensions HTTP content/header matching APIs (moving convenience overloads into extension blocks and splitting concerns across new partial files) and strengthens test expectations around WithFormData when using setup and validation in one test.

Key Changes:

  • Added an invocation verification in the WithFormData_ShouldMatchParametersInAnyOrder test.
  • Moved several IHttpContentParameter / IHttpHeaderParameter convenience overloads from interfaces into extension(...) blocks and introduced helpers/wrappers to support chaining.
  • Extracted WithString, WithFormData, WithBytes, and WithHeaders logic into dedicated partial files and updated API expectation baselines.

@vbreuss vbreuss self-assigned this Feb 9, 2026
Copilot AI review requested due to automatic review settings February 9, 2026 11:22
@vbreuss vbreuss added the bug Something isn't working label Feb 9, 2026
@vbreuss vbreuss changed the title fix: validation in FormData access fix: enable Validation when using form-data access Feb 9, 2026
@vbreuss vbreuss changed the title fix: enable Validation when using form-data access fix: enable validation when using form-data access Feb 9, 2026

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

Refactors ItExtensions HTTP content/header matching APIs (moving convenience overloads into extension blocks and splitting concerns across new partial files) and strengthens test expectations around WithFormData validation.

Changes:

  • Added an invocation verification in the WithFormData_ShouldMatchParametersInAnyOrder test.
  • Moved several IHttpContentParameter / IHttpHeaderParameter convenience overloads from interfaces into extension(...) blocks and introduced helpers/wrappers to support chaining.
  • Extracted WithString, WithFormData, and WithBytes logic into dedicated partial files and updated API expectation baselines.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/Mockolate.Tests/Web/ItExtensionsTests.IsHttpContentTests.WithFormDataTests.cs Adds an explicit verification that PostAsync was invoked with expected WithFormData values.
Tests/Mockolate.Api.Tests/Expected/Mockolate_netstandard2.0.txt Updates expected public API surface to reflect extension-block moved members.
Tests/Mockolate.Api.Tests/Expected/Mockolate_net8.0.txt Updates expected public API surface to reflect extension-block moved members.
Tests/Mockolate.Api.Tests/Expected/Mockolate_net10.0.txt Updates expected public API surface to reflect extension-block moved members.
Source/Mockolate/Web/ItExtensions.cs Adds header parsing helper and restructures IHttpHeaderParameter API with extension-block overloads.
Source/Mockolate/Web/ItExtensions.HttpContent.cs Removes in-file string/form-data helpers, introduces wrapper, and simplifies matchers.
Source/Mockolate/Web/ItExtensions.HttpContent.WithString.cs Reintroduces string-body exact/wildcard/regex matching via wrapper + extension-block APIs.
Source/Mockolate/Web/ItExtensions.HttpContent.WithFormData.cs Reintroduces form-data matching via wrapper + extension-block APIs, including new multipart-stripping parsing.
Source/Mockolate/Web/ItExtensions.HttpContent.WithBytes.cs Reintroduces byte-array equality matching via extension-block API.

Comment thread Source/Mockolate/Web/ItExtensions.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithFormData.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.cs Outdated
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithFormData.cs
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

Test Results

    21 files  ±0      21 suites  ±0   5m 27s ⏱️ -8s
 2 718 tests ±0   2 717 ✅ ±0  1 💤 ±0  0 ❌ ±0 
18 242 runs  ±0  18 241 ✅ ±0  1 💤 ±0  0 ❌ ±0 

Results for commit 4a16a96. ± Comparison against base commit 6b966c3.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.3 LTS (Noble Numbat)
AMD EPYC 7763 2.76GHz, 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.565 μs 0.0303 μs 0.0284 μs 0.2270 - 3.73 KB
Simple_Moq 177.793 μs 0.5343 μs 0.4737 μs 0.4883 - 14.71 KB
Simple_NSubstitute 6.905 μs 0.0680 μs 0.0636 μs 0.5569 0.0076 9.14 KB
Simple_FakeItEasy 6.706 μs 0.0936 μs 0.0876 μs 0.5035 - 8.27 KB

Copilot AI review requested due to automatic review settings February 9, 2026 11:36

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 11 out of 11 changed files in this pull request and generated 2 comments.

Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithHeaders.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithHeaders.cs Outdated
Copilot AI review requested due to automatic review settings February 10, 2026 17:12

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 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithHeaders.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithHeaders.cs
Copilot AI review requested due to automatic review settings February 10, 2026 17:20

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 11 out of 11 changed files in this pull request and generated 3 comments.

Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithHeaders.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithFormData.cs
Comment thread Source/Mockolate/Web/ItExtensions.HttpContent.WithFormData.cs
@vbreuss vbreuss enabled auto-merge (squash) February 10, 2026 17:24
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss vbreuss merged commit 86e818a into main Feb 10, 2026
12 checks passed
@vbreuss vbreuss deleted the topic/fix-formdata branch February 10, 2026 17:28
@github-actions github-actions Bot added the state: released The issue is released label Feb 10, 2026
@github-actions

Copy link
Copy Markdown

This is addressed in release v1.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working state: released The issue is released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants