Skip to content

Document NUnit Result inference limitation and typed assertion solution - #313

Draft
sergey-tihon with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-generic-inference-issue
Draft

sergey-tihon with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-generic-inference-issue

Conversation

Copilot AI commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

should equal accepts the actual value as obj, leaving unused Result type parameters unconstrained. Identically printed values can therefore compare unequal as Result<CommitMessage, obj> and Result<CommitMessage, string>.

  • Guidance: Document FsUnitTyped.shouldEqual, which links expected and actual types, and the explicit-annotation alternative. Preserve the existing DSL; requiring matching types would break assertions such as should contain.
  • Regression coverage: Add cases for inferred Ok/Error type parameters and rejection of unequal payloads or cases.
open FsUnitTyped

type CommitMessage = { Type: string }

let expected: Result<_, string> = Ok { Type = "feat" }
Ok { Type = "feat" } |> shouldEqual expected

Production behavior remains unchanged.

…ertions

Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix non-provided generics inference in NUnit tests Document NUnit Result inference limitation and typed assertion solution Oct 9, 2026
Copilot AI requested a review from sergey-tihon October 9, 2026 17:30

This branch has not been deployed

No deployments
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.

[NUnit] Non provided generics is inferred to obj making test fails

2 participants