Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR consolidates the StartsWith/EndsWith string assertion methods with the existing AsPrefix/AsSuffix functionality by refactoring them to use a unified IsEqualToConstraint approach instead of separate constraint implementations. The change is marked as breaking (refactor!:).
- Replaces
StartsWithConstraintandEndsWithConstraintwithIsEqualToConstraintusing prefix/suffix options - Updates method return types from
StringEqualityTypeResulttoStringEqualityResult - Improves error messages to show detailed diff information and actual values
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| Source/aweXpect/That/Strings/ThatString.StartsWith.cs | Refactors StartsWith/DoesNotStartWith to use IsEqualToConstraint with AsPrefix() option |
| Source/aweXpect/That/Strings/ThatString.EndsWith.cs | Refactors EndsWith/DoesNotEndWith to use IsEqualToConstraint with AsSuffix() option |
| Tests/aweXpect.Api.Tests/Expected/aweXpect_netstandard2.0.txt | Updates API surface to reflect StringEqualityResult return types |
| Tests/aweXpect.Api.Tests/Expected/aweXpect_net8.0.txt | Updates API surface to reflect StringEqualityResult return types |
| Tests/aweXpect.Tests/Strings/*.Tests.cs | Updates test expectations for improved error message formatting |
| Source/aweXpect.Core/Options/CollectionMatchOptions.cs | Refactors private field to public property in ExpectationItem |
| Source/aweXpect/That/Collections/ThatEnumerable.HasItemThat.cs | Updates ManualExpectationBuilder constructor calls |
| Source/aweXpect/That/Collections/ThatAsyncEnumerable.HasItemThat.cs | Updates ManualExpectationBuilder constructor calls |
Comments suppressed due to low confidence (1)
Tests/aweXpect.Tests/Strings/ThatString.IsNotEqualTo.Tests.cs:1
- Method name contains a typo: 'Ununexpected' should be 'Unexpected'.
namespace aweXpect.Tests;
|
Test Results 14 files - 24 14 suites - 24 5m 18s ⏱️ -24s Results for commit 2f0812c. ± Comparison against base commit d94595c. This pull request removes 1575 and adds 1551 tests. Note that renamed tests count towards both. |
🚀 Benchmark ResultsDetails
|
👽 Mutation ResultsaweXpectDetails
The final mutation score is 49.28%Coverage Thresholds: high:80 low:60 break:0aweXpect.CoreDetails
The final mutation score is 95.24%Coverage Thresholds: high:80 low:60 break:0 |
…dsWith` and `AsPrefix`/`AsSuffix` for strings (#763) by Valentin Breuß
…dsWith` and `AsPrefix`/`AsSuffix` for strings (#763) by Valentin Breuß
|
This is addressed in release v2.23.0. |




This PR consolidates the
StartsWith/EndsWithstring assertion methods with the existingAsPrefix/AsSuffixfunctionality by refactoring them to use a unifiedIsEqualToConstraintapproach instead of separate constraint implementations. The change is marked as breaking (refactor!:), because the return type was incorrectly set toStringEqualityTypeResultand is now fixed.Key changes:
StartsWithConstraintandEndsWithConstraintwithIsEqualToConstraintusing prefix/suffix optionsStringEqualityTypeResulttoStringEqualityResultStartsWithandEndsWith#702