You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Testing: assertions on a Task or ValueTask of an Option, a Result and a Patch #87
CodoMetis.TypeKit.Testing asserts on an Option, a Result, a Patch and a composed fault, but only when the test already holds the value. A test of an async method writes (await service.Find(id)).ShouldBeSuccess(). The roadmap's 2.3.0 section lists async assertions.
Proposal
The assertions on a Task<…> and a ValueTask<…> of each: await service.Find(id).ShouldBeSuccess(), ShouldBeError(…), ShouldBeSome(), ShouldBeNone(), and the Patch ones, returning what the synchronous form returns. Messages as the synchronous forms write them.
Done when
Every synchronous assertion has its Task and ValueTask form, checked by a completeness test over the public surface.
A faulted task's exception propagates as it is, not wrapped in an assertion failure.
The Testing README shows them as compiled samples.
An assertion on a task left without await is reported (CMTK0003). Without await it passes whatever the task holds, and C# warns only in an async method. The rule knows the assertions by the Testing assembly's identity, so a consumer's own extension on a pending result is not reported, and no build that worked before 2.3 breaks. (Scope added while implementing.)
Activity
CaffeinatedCoder commentedon Oct 28, 2026
Done in PR #95, merged into release/2.3.0.