Skip to content

Comments

Added Ensure.Arg.OfType() and Ensure.Arg.OfGenericType() with object argument.#51

Merged
prochnowc merged 1 commit intomainfrom
ensure-oftype-value
May 22, 2025
Merged

Added Ensure.Arg.OfType() and Ensure.Arg.OfGenericType() with object argument.#51
prochnowc merged 1 commit intomainfrom
ensure-oftype-value

Conversation

@prochnowc
Copy link
Contributor

No description provided.

@prochnowc prochnowc requested a review from Copilot May 22, 2025 17:53
Copy link

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

Adds object-based overloads for Ensure.Arg.OfType and Ensure.Arg.OfGenericType to simplify runtime value checks and extends unit tests to cover these new methods.

  • Introduces OfType(object?, Type, string?) and OfType<TExpected>(object?, string?) overloads
  • Introduces OfGenericType(object?, Type, string?) and OfGenericType<TExpected>(object?, string?) overloads
  • Adds corresponding tests for related, unrelated, and null value scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
test/AppCoreNet.Diagnostics.Tests/EnsureTests.Arg.cs Added tests for the new object-based OfType and OfGenericType overloads
src/AppCoreNet.Diagnostics.Sources/Ensure.Arg.cs Implemented the new overloads and XML docs for OfType and OfGenericType
Comments suppressed due to low confidence (1)

test/AppCoreNet.Diagnostics.Tests/EnsureTests.Arg.cs:184

  • Consider adding tests for passing a null expectedType to both OfType and OfGenericType overloads, asserting that an ArgumentNullException is thrown.
[Theory]

@prochnowc prochnowc merged commit 749d8b9 into main May 22, 2025
5 checks passed
@prochnowc prochnowc deleted the ensure-oftype-value branch May 22, 2025 17:56
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.

1 participant