String Inspection Guards#154
Merged
Merged
Conversation
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
…n CI Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
18 tasks
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new family of allocation-free string inspection predicates and fluent throwing guards (digits, letters-or-digits, casing, Base64, hex, and whitespace) across string, span, and memory receiver shapes, aligned with the library’s existing assertion patterns and source-export distribution model. The PR also updates the test/tooling stack to xUnit v3 on Microsoft Testing Platform and enables CI code coverage reporting.
Changes:
- Introduces string-inspection predicates (
ContainsOnlyDigits,ContainsOnlyLettersOrDigits,IsUpperCase,IsLowerCase,IsBase64,IsHexadecimal) and guards (Must*variants plusMustNotContainWhiteSpace) for all required receiver shapes. - Aligns
MustBeAsciicharacter-sequence overloads to throwStringExceptionfor invalid non-null string content (keeping scalar/byte overload behavior unchanged). - Updates tests, source-export whitelist plumbing, benchmarks, docs, and GitHub Actions to support xUnit v3 + Microsoft Testing Platform with coverage artifacts and PR coverage comments.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/source-export/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs | Ensures Net10 single-file exports include required framework usings for new Base64 APIs. |
| tools/source-export/Light.GuardClauses.SourceCodeTransformation/settings.json | Adds new string-inspection assertion families to the source-export whitelist settings. |
| tools/source-export/Light.GuardClauses.SourceCodeTransformation/AssertionWhitelist.cs | Extends whitelist model with entries for the new predicates/guards. |
| src/Light.GuardClauses/ExceptionFactory/Throw.InvalidStringContent.cs | Adds a centralized helper for throwing StringException for invalid string content. |
| src/Light.GuardClauses/Check.MustNotContainWhiteSpace.cs | Adds throwing-only whitespace rejection guard across all receiver shapes. |
| src/Light.GuardClauses/Check.MustContainOnlyLettersOrDigits.cs | Adds guard requiring Unicode letter-or-digit content across all receiver shapes. |
| src/Light.GuardClauses/Check.MustContainOnlyDigits.cs | Adds guard requiring Unicode digit content across all receiver shapes. |
| src/Light.GuardClauses/Check.MustBeUpperCase.cs | Adds guard requiring absence of Unicode lowercase characters across all receiver shapes. |
| src/Light.GuardClauses/Check.MustBeLowerCase.cs | Adds guard requiring absence of Unicode uppercase characters across all receiver shapes. |
| src/Light.GuardClauses/Check.MustBeHexadecimal.cs | Adds guard requiring ASCII hex content across all receiver shapes. |
| src/Light.GuardClauses/Check.MustBeBase64.cs | Adds guard requiring structurally valid standard Base64 across all receiver shapes. |
| src/Light.GuardClauses/Check.MustBeAscii.cs | Updates character-sequence MustBeAscii to throw StringException for invalid non-null content and refreshes XML docs. |
| src/Light.GuardClauses/Check.IsUpperCase.cs | Adds casing predicate (no lowercase chars) across all receiver shapes. |
| src/Light.GuardClauses/Check.IsLowerCase.cs | Adds casing predicate (no uppercase chars) across all receiver shapes. |
| src/Light.GuardClauses/Check.IsHexadecimal.cs | Adds hex predicate with Net10 fast-path (char.IsAsciiHexDigit) and portable fallback. |
| src/Light.GuardClauses/Check.IsBase64.cs | Adds Base64 predicate using Net10 Base64.IsValid and a portable validator fallback. |
| src/Light.GuardClauses/Check.ContainsOnlyLettersOrDigits.cs | Adds Unicode alphanumeric predicate across all receiver shapes. |
| src/Light.GuardClauses/Check.ContainsOnlyDigits.cs | Adds Unicode digit predicate across all receiver shapes. |
| tests/Directory.Build.props | Migrates test projects to Microsoft Testing Platform runner and enables TRX + coverage extensions. |
| tests/Light.GuardClauses.Tests/Test.cs | Updates test helper imports for xUnit v3 usage. |
| tests/Light.GuardClauses.Tests/StringAssertions/StringInspectionPredicateTests.cs | Adds conformance tests for predicate semantics + Base64 portability differential tests. |
| tests/Light.GuardClauses.Tests/StringAssertions/StringInspectionGuardTests.cs | Adds conformance tests for guard return-shape, null/invalid behavior, and custom factories. |
| tests/Light.GuardClauses.Tests/StringAssertions/OrdinalIgnoreWhiteSpaceComparerTests.cs | Updates output helper null-guard usage for new CallerArgumentExpression behavior. |
| tests/Light.GuardClauses.Tests/StringAssertions/OrdinalIgnoreCaseIgnoreWhiteSpaceComparerTests.cs | Updates output helper null-guard usage for new CallerArgumentExpression behavior. |
| tests/Light.GuardClauses.Tests/StringAssertions/AsciiTests.cs | Updates expectations for MustBeAscii string/span/memory exception behavior (StringException). |
| tests/Light.GuardClauses.Tests/DefaultVariablesData.cs | Updates custom data attribute for xUnit v3 discovery/data-row model (currently contains a compile error). |
| tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerWhitelistTests.cs | Adds whitelist reachability/trimming tests for new string-inspection families and portable Base64 validator. |
| tests/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs | Extends framework-conditional export tests to validate Net10 vs NetStandard Base64/hex compilation output. |
| tests/Light.GuardClauses.SourceCodeTransformation.Tests/ParseCSharpFilesWithRoslynTests.cs | Updates Roslyn parse calls to use the test cancellation token. |
| benchmarks/Light.GuardClauses.Performance/StringAssertions/StringInspectionBenchmark.cs | Adds microbenchmarks for new predicates/guards (digits, alphanumeric, Base64, whitespace). |
| docs/contributing-and-building.md | Updates local build/test instructions for Microsoft Testing Platform and coverage flags. |
| docs/assertion-overview.md | Documents the new string-inspection predicates/guards and their semantics. |
| Directory.Packages.props | Updates central package versions (BenchmarkDotNet/FluentAssertions) and switches to MTP + xUnit v3 packages. |
| global.json | Declares Microsoft Testing Platform as the test runner in repo configuration. |
| ai-plans/0153-string-inspection-guards.md | Adds the implementation plan/acceptance-criteria checklist for issue #153. |
| .github/workflows/build-and-test.yml | Updates CI triggers, runs tests with coverage, produces coverage artifacts, and posts a sticky PR coverage comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #153
Also upgrades xunit to v3, introduces Microsoft.Testing.Platform v2 and enabled code coverage reporting in GitHub Actions.