Increase Code Coverage#155
Merged
Merged
Conversation
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases test coverage across Light.GuardClauses by adding/expanding unit tests for guard clause overloads (including span/memory buffer shapes) and several framework extension helpers, and by documenting test-writing expectations.
Changes:
- Added new tests to cover additional success/failure paths and “factory not invoked on success” scenarios across string/numeric/buffer guard clauses.
- Added new tests for framework extension helpers (text/exception message formatting, enumerable counting, hash generation, string representations).
- Introduced test guidelines documentation and linked it from the root AGENTS.md; added solution items for easier discovery.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Light.GuardClauses.Tests/StringAssertions/MustNotStartWithTests.cs | Adds span overload coverage and additional factory/success+failure path assertions. |
| tests/Light.GuardClauses.Tests/StringAssertions/MustBeEmailAddressTests.cs | Adjusts existing tests and adds buffer-overload success-path coverage. |
| tests/Light.GuardClauses.Tests/StringAssertions/AsciiTests.cs | Expands ASCII validation tests, including “factory not invoked” success-path checks. |
| tests/Light.GuardClauses.Tests/FrameworkExtensions/ToStringRepresentationTests.cs | Adds coverage for primitive/unquoted handling, nulls, and representation edge cases. |
| tests/Light.GuardClauses.Tests/FrameworkExtensions/TextExtensionsTests.cs | Adds coverage for exception message aggregation and whitespace-ignoring equality. |
| tests/Light.GuardClauses.Tests/FrameworkExtensions/MultiplyAddHashTests.cs | Adds coverage ensuring all supported CreateHashCode arities match the builder behavior. |
| tests/Light.GuardClauses.Tests/FrameworkExtensions/EnumerableCountTests.cs | Adds coverage for optimized counting strategies and enumeration behavior. |
| tests/Light.GuardClauses.Tests/ComparableAssertions/NumericCustomFactorySuccessTests.cs | Adds coverage that custom factories are not invoked on numeric success paths. |
| tests/AGENTS.md | Introduces explicit test-writing rules and how to run coverage. |
| Light.GuardClauses.slnx | Adds solution items to surface new build/test guidance files. |
| AGENTS.md | Links root guidance to the new test-specific guidance document. |
Comments suppressed due to low confidence (1)
tests/Light.GuardClauses.Tests/StringAssertions/MustBeEmailAddressTests.cs:38
- This test is named InvalidEmailAddressArgumentName but it no longer asserts the exception's ParamName; it currently duplicates InvalidEmailAddress by only checking the message. Asserting ParamName here makes the intent explicit and prevents regressions in argument-name handling.
act.Should().Throw<InvalidEmailAddressException>()
.And.Message.Should().Contain(
$"emailAddress must be a valid email address, but it actually is \"{emailAddress}\"."
);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
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.
Increases code coverage for the Light.GuardClauses project