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: assert a union error's case without matching on it (net11.0) #210
Assert which case of a union error a Result failed with. With a union TError (public union OrderFault(NotFound, Conflict);), ShouldBeError() returns the union, and the test then has to match on it. On Metalama 2026.1 (2.3.x) a woven test project can't do that at all (CS8652, decision 120); 2.4.0 moves to Metalama 2027.0 (decision 129), where it can, and the assertion still saves the match.
What you'd like
A net11.0-only member in CodoMetis.TypeKit.Testing that does the matching inside TypeKit's own C# 15 build, so the test only names the case type:
TError is constrained to IUnion, and the case is read through IUnion.Value, so a custom union works too.
On failure, the message names the expected case and the actual case's type, never the content. That is the same rule as the rest of the Testing package.
The name, and whether Option<TUnion> gets a sibling, are decided in the PR.
Async forms like the existing ShouldBeError overloads, if the package's pattern asks for them.
To measure: that a woven net11.0 project on Metalama 2027.0 calls it, and a net10.0 one does not see it.
A claim in test/oracles/claims.json for the new member; the changelog says it's net11.0 only.
Does it change something that compiles or works today?
Activity