Skip to content

fix: overload resolution for IEnumerable#639

Merged
vbreuss merged 2 commits intomainfrom
topic/fix-enumerable-overload
Jun 19, 2025
Merged

fix: overload resolution for IEnumerable#639
vbreuss merged 2 commits intomainfrom
topic/fix-enumerable-overload

Conversation

@vbreuss
Copy link
Copy Markdown
Member

@vbreuss vbreuss commented Jun 19, 2025

Improve overload resolution for IEnumerable by replacing nullable and generic type parameters with non‑nullable IEnumerable.

@vbreuss vbreuss self-assigned this Jun 19, 2025
Copilot AI review requested due to automatic review settings June 19, 2025 13:20
@vbreuss vbreuss added the bug Something isn't working label Jun 19, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request refactors a large number of extension methods in the ThatEnumerable suite to improve overload resolution for IEnumerable by replacing nullable and generic type parameters with non‑nullable IEnumerable. The changes simplify method signatures and return types across various collection verification methods.

  • Updated overloads for methods such as MoreThan, LessThan, IsInDescendingOrder, IsInAscendingOrder, etc.
  • Standardized the use of IThat in place of IThat<IEnumerable?>, improving clarity and consistency.
  • Revised related return types and underlying constraint constructions accordingly.

Reviewed Changes

Copilot reviewed 20 out of 55 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Source/aweXpect/That/Collections/ThatEnumerable.MoreThan.cs Changed method signature to use IThat instead of nullable.
Source/aweXpect/That/Collections/ThatEnumerable.LessThan.cs Updated parameter types to non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.IsInDescendingOrder.cs Refactored ordering methods to standardize on non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.IsInAscendingOrder.cs Revised method signatures to enhance overload resolution.
Source/aweXpect/That/Collections/ThatEnumerable.IsEqualTo.cs Changed equality method signature to use IThat.
Source/aweXpect/That/Collections/ThatEnumerable.IsContainedIn.cs Updated containment verification to use non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.HasSingle.cs Simplified HasSingle signature by removing unnecessary generic types.
Source/aweXpect/That/Collections/ThatEnumerable.HasCount.cs Standardized count verifications across different overloads.
Source/aweXpect/That/Collections/ThatEnumerable.Exactly.cs Updated exactly count check method signature.
Source/aweXpect/That/Collections/ThatEnumerable.EndsWith.cs Changed method signature for EndsWith methods to use non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.Elements.Satisfy.cs Updated signature consistency in predicate-based methods.
Source/aweXpect/That/Collections/ThatEnumerable.Elements.ComplyWith.cs Revised constraint application to use non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.Elements.AreEquivalentTo.cs Updated equivalence check signatures to non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.Elements.AreEqualTo.cs Standardized signatures in equality verification for elements.
Source/aweXpect/That/Collections/ThatEnumerable.Contains.cs Changed methods to use non‑nullable IEnumerable in containment checks.
Source/aweXpect/That/Collections/ThatEnumerable.Between.cs Updated Between method signature for improved overload resolution.
Source/aweXpect/That/Collections/ThatEnumerable.AtMost.cs Modified method signature to use non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.AtLeast.cs Updated method signature to use non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.AreAllUnique.cs Refactored uniqueness methods for consistency with non‑nullable IEnumerable.
Source/aweXpect/That/Collections/ThatEnumerable.All.cs Updated All method signature to use IThat exclusively.
Comments suppressed due to low confidence (5)

Source/aweXpect/That/Collections/ThatEnumerable.MoreThan.cs:32

  • The change from IThat<IEnumerable?> to IThat improves overload resolution, but please verify that this API change is compatible with all caller scenarios, especially regarding the handling of null subjects.
	public static ElementsForEnumerable<IEnumerable> MoreThan(

Source/aweXpect/That/Collections/ThatEnumerable.IsEqualTo.cs:285

  • Changing the signature from using nullable subject types to non‑nullable IEnumerable enhances clarity; ensure that all consumers of this API have been updated accordingly.
		IsEqualTo<TItem>(

Source/aweXpect/That/Collections/ThatEnumerable.HasCount.cs:89

  • Standardizing the parameter to IThat streamlines the API; confirm that this change does not omit valid use cases where a nullable subject might be expected.
	public static AndOrResult<IEnumerable, IThat<IEnumerable>> HasCount(

Source/aweXpect/That/Collections/ThatEnumerable.EndsWith.cs:110

  • Updating the EndsWith overload to use a non‑nullable IEnumerable improves overload resolution; please check that existing usage patterns are fully supported.
		EndsWith<TItem>(

Source/aweXpect/That/Collections/ThatEnumerable.All.cs:30

  • The refactoring of the All method to use IThat aligns with the overall API improvements; verify that any dependencies on previous nullable types are updated accordingly.
	public static ElementsForEnumerable<IEnumerable> All(

@vbreuss vbreuss force-pushed the topic/fix-enumerable-overload branch from b596437 to b044122 Compare June 19, 2025 13:20
@vbreuss vbreuss enabled auto-merge (squash) June 19, 2025 13:22
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 19, 2025

Test Results

    14 files   - 24      14 suites   - 24   2m 42s ⏱️ -3s
13 526 tests  - 26  13 524 ✅  - 26  2 💤 ±0  0 ❌ ±0 
37 623 runs   - 72  37 621 ✅  - 72  2 💤 ±0  0 ❌ ±0 

Results for commit ab59a80. ± Comparison against base commit a2199ea.

♻️ This comment has been updated with latest results.

@vbreuss vbreuss disabled auto-merge June 19, 2025 13:27
@sonarqubecloud
Copy link
Copy Markdown

@vbreuss vbreuss enabled auto-merge (squash) June 19, 2025 13:35
@vbreuss vbreuss merged commit 92019bd into main Jun 19, 2025
13 checks passed
@vbreuss vbreuss deleted the topic/fix-enumerable-overload branch June 19, 2025 13:39
github-actions Bot added a commit that referenced this pull request Jun 19, 2025
github-actions Bot added a commit that referenced this pull request Jun 19, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 19, 2025

🚀 Benchmark Results

Details

BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
AMD EPYC 7763, 1 CPU, 4 logical and 2 physical cores
.NET SDK 8.0.411
[Host] : .NET 8.0.17 (8.0.1725.26602), X64 RyuJIT AVX2

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

Method Mean Error StdDev Gen0 Gen1 Allocated
Bool_aweXpect 190.8 ns 2.79 ns 2.61 ns 0.0281 - 472 B
Bool_FluentAssertions 241.8 ns 3.60 ns 3.36 ns 0.0567 - 952 B
Bool_TUnit 894.8 ns 7.81 ns 7.30 ns 0.1440 - 2416 B
Equivalency_aweXpect 306,409.6 ns 1,755.93 ns 1,642.50 ns 16.6016 0.4883 284940 B
Equivalency_FluentAssertions 2,194,562.2 ns 9,676.65 ns 8,080.44 ns 273.4375 46.8750 4584416 B
Equivalency_TUnit 685,818.4 ns 6,378.85 ns 5,966.78 ns 51.7578 2.9297 866777 B
Int_GreaterThan_aweXpect 218.2 ns 1.95 ns 1.63 ns 0.0467 - 784 B
Int_GreaterThan_FluentAssertions 260.6 ns 5.61 ns 5.24 ns 0.0730 - 1224 B
Int_GreaterThan_TUnit 1,244.2 ns 9.64 ns 9.01 ns 0.1774 - 2992 B
ItemsCount_AtLeast_aweXpect 424.8 ns 7.10 ns 6.64 ns 0.0830 - 1392 B
ItemsCount_AtLeast_FluentAssertions 524.8 ns 15.56 ns 14.56 ns 0.1192 - 2008 B
ItemsCount_AtLeast_TUnit 14,158.3 ns 134.17 ns 112.04 ns 1.6327 - 27488 B
String_aweXpect 333.3 ns 6.88 ns 6.43 ns 0.0672 - 1128 B
String_FluentAssertions 467.6 ns 4.72 ns 4.41 ns 0.1292 - 2168 B
String_TUnit 1,302.6 ns 4.25 ns 3.31 ns 0.1850 - 3096 B
StringArray_aweXpect 1,256.1 ns 5.83 ns 5.45 ns 0.1602 - 2712 B
StringArray_FluentAssertions 1,234.5 ns 7.57 ns 6.71 ns 0.2480 - 4152 B
StringArray_TUnit 2,750.8 ns 10.57 ns 9.88 ns 0.2708 - 4576 B
StringArrayInAnyOrder_aweXpect 1,394.3 ns 5.31 ns 4.70 ns 0.1717 - 2872 B
StringArrayInAnyOrder_FluentAssertions 151,837.0 ns 727.47 ns 680.47 ns 3.4180 - 63351 B
StringArrayInAnyOrder_TUnit 4,526.8 ns 14.35 ns 11.20 ns 0.3967 - 6744 B

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 19, 2025

👽 Mutation Results

Mutation testing badge

aweXpect

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants
That/Collections/ThatEnumerable.AreAllUnique.cs 88.76% 79 6 0 4 20 35 79 10 144
That/Collections/ThatEnumerable.Contains.cs 89.70% 148 3 0 14 49 46 148 17 260
That/Collections/ThatEnumerable.cs 86.21% 222 6 3 30 76 131 225 36 468
That/Collections/ThatEnumerable.Elements.AreEqualTo.cs 41.54% 27 0 0 38 13 104 27 38 182
That/Collections/ThatEnumerable.Elements.AreEquivalentTo.cs 44.44% 12 5 0 10 3 24 12 15 54
That/Collections/ThatEnumerable.Elements.ComplyWith.cs 75.71% 52 3 1 14 21 18 53 17 109
That/Collections/ThatEnumerable.Elements.Satisfy.cs 53.33% 16 0 0 14 5 40 16 14 75
That/Collections/ThatEnumerable.EndsWith.cs 97.56% 120 3 0 0 24 46 120 3 193
That/Collections/ThatEnumerable.HasCount.cs 100.00% 12 0 0 0 0 0 12 0 12
That/Collections/ThatEnumerable.HasSingle.cs 97.30% 72 0 0 2 33 24 72 2 131
That/Collections/ThatEnumerable.IsContainedIn.cs 100.00% 10 0 0 0 0 0 10 0 10
That/Collections/ThatEnumerable.IsEqualTo.cs 100.00% 26 0 0 0 0 0 26 0 26
That/Collections/ThatEnumerable.IsInAscendingOrder.cs 66.67% 8 0 0 4 12 0 8 4 24
That/Collections/ThatEnumerable.IsInDescendingOrder.cs 66.67% 8 0 0 4 12 0 8 4 24
That/Collections/ThatEnumerable.None.cs 100.00% 5 0 0 0 0 0 5 0 5
That/Collections/ThatEnumerable.StartsWith.cs 99.08% 108 1 0 0 22 44 108 1 175

The final mutation score is 85.23%

Coverage Thresholds: high:80 low:60 break:0

aweXpect.Core

Details
File Score Killed Survived Timeout No Coverage Ignored Compile Errors Total Detected Total Undetected Total Mutants

The final mutation score is NaN%

Coverage Thresholds: high:80 low:60 break:0

@github-actions
Copy link
Copy Markdown
Contributor

This is addressed in release v2.16.0.

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