Skip to content

refactor: name every expectation receiver subject - #1122

Merged
vbreuss merged 1 commit into
mainfrom
refactor/rename-receiver-parameter
Sep 15, 2026
Merged

vbreuss merged 1 commit into
mainfrom
refactor/rename-receiver-parameter

Conversation

@vbreuss

@vbreuss vbreuss commented Sep 15, 2026

Copy link
Copy Markdown
Member

The receiver parameter was source in 792 signatures and subject in 78, a split that was historical rather than semantic: the subject group is just the collection quantifier family plus HasCount. source is LINQ vocabulary for a sequence, while the library calls the value under test the subject everywhere else - IThatSubject<T>, ThatSubject<T>, IDescribableSubject.

Renaming a this parameter cannot affect extension-method invocation syntax, so this only reaches callers that use static-form invocation with named arguments. The API approval diff is the proof that nothing else moved: all 2536 changed lines are parameter names.

LinqAsyncHelpers keeps source, where it genuinely is a sequence. Two smaller receivers follow the same reasoning: the equivalency extensions no longer need the escaped @this, and the ValueFormatter overloads that ignore their receiver spell it formatter like the other 82 instead of _.


@vbreuss
vbreuss enabled auto-merge (squash) September 15, 2026 09:16
@vbreuss
vbreuss disabled auto-merge September 15, 2026 09:17
@vbreuss
vbreuss force-pushed the refactor/rename-receiver-parameter branch from 0f8f5f7 to 4ed3d5d Compare September 15, 2026 09:20
The receiver parameter was `source` in 792 signatures and `subject` in 78, a split that was historical rather than semantic: the `subject` group is just the collection quantifier family plus `HasCount`. `source` is LINQ vocabulary for a sequence, while the library calls the value under test the subject everywhere else - `IThatSubject<T>`, `ThatSubject<T>`, `IDescribableSubject`.

Renaming a `this` parameter cannot affect extension-method invocation syntax, so this only reaches callers that use static-form invocation with named arguments. The API approval diff is the proof that nothing else moved: every changed line is a parameter name, and no `source` is left anywhere in the public surface.

Two places beyond the extension receivers followed, because they carry the same subject: the expectation source generator, whose template would otherwise keep emitting `source` into the generated `ThatChar` and `ThatGuid` expectations, and the `PropertyResult` constructors, which take the subject rather than a receiver but are public API all the same.

`LinqAsyncHelpers` keeps `source`, where it genuinely is a sequence. Two smaller receivers follow the same reasoning: the equivalency extensions no longer need the escaped `@this`, and the `ValueFormatter` overloads that ignore their receiver spell it `formatter` like the other 82 instead of `_`.

Closes #1119
@vbreuss
vbreuss force-pushed the refactor/rename-receiver-parameter branch from 4ed3d5d to f51ae5c Compare September 15, 2026 09:26
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

     26 files   -  27       26 suites   - 27   10m 6s ⏱️ - 1m 19s
 20 575 tests  -  40   20 573 ✅  -  40  2 💤 ±0  0 ❌ ±0 
106 469 runs   - 108  106 467 ✅  - 108  2 💤 ±0  0 ❌ ±0 

Results for commit f51ae5c. ± Comparison against base commit d095969.

This pull request removes 3232 and adds 3192 tests. Note that renamed tests count towards both.
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message10bd4f85-3acb-409b-9e25-d0117cdbfb05")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message3165782e-d17e-4963-b284-3899f30b1ef0")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message628b85bc-3247-4604-abb4-5061e2c2674d")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message86add03f-98d2-44a2-8a77-5ddf6f8b3d8f")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message9a5e1222-58c1-4759-b92e-432d19f1dd43")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messaged21eb396-da4d-4f49-8fe6-3d7e6dad51f1")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message210d3bb8-46d2-4648-82cb-d38113599a46")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message2b62b473-9e33-4fe5-86a8-a9b359df637c")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messagea87cde80-89a6-4cb2-bbf7-f5bd248149df")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messageaa381218-ab9d-4fa0-8c61-ffcdd2949ff8")
…
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message11c2ccbc-fe7b-412b-beac-4819fb1f1f58")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message153948d8-c47f-4fd1-9ffd-6ed04b64bf48")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "message7e1dd9cd-7709-4fd7-bd05-c89714594d2c")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messageaae21300-081d-49f3-bf79-881dcc803e17")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messagecd8aa959-e7e2-43e2-94ba-618ccae2e710")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ InnerException_ShouldBeSet(message: "messagef53dcc7e-9d95-455f-bb9a-e4edb83420d0")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message69fbca0e-7bf9-4555-97c0-1ea347c8912e")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message6b975fb5-29a9-42d2-918c-f930b090795b")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "message73d6af1d-e82f-4557-90f8-619857b5586f")
aweXpect.Core.Tests.Core.Exceptions.FailExceptionTests ‑ Message_ShouldBeSet(message: "messageac8b0615-5a8d-4c4f-a58c-6b95ca1f0fd2")
…

@vbreuss
vbreuss merged commit d22cf29 into main Sep 15, 2026
12 of 13 checks passed
@vbreuss
vbreuss deleted the refactor/rename-receiver-parameter branch September 15, 2026 10:13
github-actions Bot added a commit that referenced this pull request Sep 15, 2026
github-actions Bot added a commit that referenced this pull request Sep 15, 2026
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Benchmark Results

Details

BenchmarkDotNet v0.15.8, Linux Ubuntu 24.04.5 LTS (Noble Numbat)
AMD EPYC 7763 2.45GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 10.0.303
[Host] : .NET 8.0.31 (8.0.31, 8.0.3126.42015), X64 RyuJIT x86-64-v3

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

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 287.3 ns 6.06 ns 5.67 ns 0.0415 - 696 B
Bool_FluentAssertions 252.7 ns 7.04 ns 6.58 ns 0.0567 - 952 B
Equivalency_aweXpect 395,284.8 ns 3,091.21 ns 2,891.52 ns 32.2266 1.4648 542085 B
Equivalency_FluentAssertions 2,764,440.9 ns 33,854.43 ns 31,667.46 ns 289.0625 46.8750 4841651 B
Int_GreaterThan_aweXpect 269.8 ns 1.77 ns 1.57 ns 0.0515 - 864 B
Int_GreaterThan_FluentAssertions 244.6 ns 3.15 ns 2.63 ns 0.0730 - 1224 B
ItemsCount_AtLeast_aweXpect 475.8 ns 4.38 ns 3.88 ns 0.0811 - 1360 B
ItemsCount_AtLeast_FluentAssertions 508.9 ns 6.79 ns 6.35 ns 0.1192 - 2008 B
String_aweXpect 505.5 ns 4.31 ns 4.03 ns 0.0668 - 1128 B
String_FluentAssertions 1,252.5 ns 16.92 ns 15.82 ns 0.2346 - 3944 B
StringArray_aweXpect 1,961.1 ns 11.83 ns 9.88 ns 0.1564 - 2624 B
StringArray_FluentAssertions 1,367.3 ns 10.55 ns 9.87 ns 0.2480 - 4152 B
StringArrayInAnyOrder_aweXpect 2,522.3 ns 13.98 ns 13.08 ns 0.1678 - 2816 B
StringArrayInAnyOrder_FluentAssertions 26,809.4 ns 201.92 ns 178.99 ns 1.9836 0.0610 33471 B

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.

Rename the receiver parameter to subject

1 participant