Skip to content

Add MustBePositiveOrInfinite assertion #175

Description

@feO2x

Context

Parent issue #162 (point 6) identifies two BrilliantMessaging guards that accept either a positive TimeSpan or the standard .NET infinite-timeout sentinel. Expressing this with a generic predicate obscures the platform convention.

Proposed API

timeout.MustBePositiveOrInfinite();

The assertion should return the original value when it is greater than TimeSpan.Zero or exactly equals Timeout.InfiniteTimeSpan. It should reject zero and every other negative value. Default and custom-exception-factory overloads should follow the existing TimeSpan sign-guard conventions.

Scope

  • Add MustBePositiveOrInfinite for TimeSpan on all supported target frameworks.
  • Cover success, failure, exception-contract, and custom-factory behavior with automated tests.
  • Expose the assertion through the source-code-transformation whitelist and verify its exported form.
  • Update assertion documentation and package release notes.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions