Skip to content

Spec 013: C# Assertion Extraction - #184

Merged
adrian-xping merged 19 commits into
mainfrom
feat/spec-013-csharp-assertion-extraction
Dec 3, 2026
Merged

adrian-xping merged 19 commits into
mainfrom
feat/spec-013-csharp-assertion-extraction

Conversation

@adrian-xping

@adrian-xping adrian-xping commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Spec 013 (docs/specs/core/013-csharp-assertion-extraction.md): C# Assertion Extraction. Built by spec-runner; a human merges this PR.

Phase PRs

Acceptance (criteria from docs/specs/work-breakdown.md)

# Criterion Result Evidence
AC-1 Per library: fixture pairs (before/after) with expected facts. met samples/assertions/ has a folder per library in §14.1 (xunit, nunit-classic, nunit-constraints, mstest, fluentassertions, shouldly, moq, nsubstitute, fakeiteasy) plus the cross-library folders, each with old.cs, new.cs and expected.json. AssertionFixtureTests.EveryAssertionFixtureMatchesItsExpectedFile checks all 20 folders against expected.json; EveryAssertionFolderTheSpecListsExists checks the folder list. Based on reading the code; tests were not run.
AC-2 A test checks that every table row is used by at least one fixture, and that an unknown method gives "unrecognized", never a guessed level. met AssertionFixtureTests.EveryTableRowIsUsedByAFixture fails if any row of any table in AssertionTables.All is not in the matcher IDs used across samples/assertions sources. AssertionExtractorTests: AnUnknownMemberIsUnrecognizedNeverGuessed, AnUnknownNUnitMemberIsUnrecognizedNeverGuessed, AnUnknownMSTestMemberIsUnrecognizedNeverGuessed, AnUnknownVerificationIsUnrecognizedNeverGuessed assert null Matcher and Level. Shouldly unknown Should members are helper calls by design (§4.3). Minor gap: hand-listed inline cases rather than one test generated from the tables. Tests were not run.
AC-3 Unknown call patterns produce "unrecognized assertion" facts, not silence. met AssertionExtractorTests assert facts with no matcher, level or subject for unknown links (AnUnknownLinkEndsTheChain), ambiguous rows (TwoMatchingRowsMakeACallUnrecognized), duplicate static imports, and unknown Times arguments. ConstraintReaderTests do the same for unknown NUnit constraints. The unrowed and imports fixtures record them in expected.json.
AC-4 The analyzer reproduces the assertions and helper calls of every C# samples/facts/ fixture (after the corrections the spec lists). met FactsFixtureTests.TheAnalyzerReproducesTheAssertionPartOfEveryFactsFixture is a theory over every samples/facts/ fixture with a facts.json; it runs CSharpTestAnalyzer and compares each test's assertions and helperCalls (valueOrigin and disabled tests excluded). The §14.2 corrections landed in commit 7fb50e1. Tests were not run.

Follow-ups created

None.

adrian-xping and others added 19 commits December 3, 2026 20:57
Spec-Runner: spec=013 step=claim
… phase 1)

Spec-Runner: spec=013 phase=1 step=implement
Spec-Runner: spec=013 phase=1 step=fix-1
…asked first

Spec-Runner: spec=013 phase=1 step=fix-2
A no that leaned on a method still being probed was recomputed on every
path through the call graph, so a cluster of mutually calling,
non-asserting methods took factorial time. Such nos now wait on the
probe they lean on: reused while it runs, cached when it ends with no,
dropped when it ends with yes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-extraction/1-engine-xunit

feat(analyzers): extract C# assertions with the xUnit table (spec 013 phase 1)
…t a comparer

Spec-Runner: spec=013 phase=2 step=fix-1
…n-extraction/2-nunit-mstest

feat(analyzers): extract NUnit and MSTest assertions (spec 013 phase 2)
…ec 013 phase 3)

Adds the chain (`x.Should().Be(3).And…`) and name-prefix (`x.ShouldBe(3)`)
entry points, the fluentassertions and shouldly tables, Invoking/Awaiting
throws subjects, and the fluentassertions and shouldly fixture folders.

Spec-Runner: spec=013 phase=3 step=implement
…ads that follow an optional slot

Spec-Runner: spec=013 phase=3 step=fix-1
…lue and document ShouldBeOneOf's message overload

Spec-Runner: spec=013 phase=3 step=fix-2
…ression positions

A named-argument label, an anonymous member name or a type with the
parameter's name can't hold a parenthesized expression; the rewriter
threw InvalidCastException on them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-extraction/3-fluent

feat(analyzers): extract FluentAssertions and Shouldly assertions (spec 013 phase 3)
…s (spec 013 phase 4)

Add the moq, nsubstitute and fakeiteasy tables with the times sub-table,
the verification, received and call-to entry points, calls roots (§8.4),
using gating for Moq and NSubstitute, and the moq, nsubstitute and
fakeiteasy fixture folders.

Spec-Runner: spec=013 phase=4 step=implement
…n-extraction/4-mocks

feat(analyzers): extract Moq, NSubstitute and FakeItEasy verifications (spec 013 phase 4)
…acts and correct the fixtures (spec 013 phase 5)

Spec-Runner: spec=013 phase=5 step=implement
…n-extraction/5-facts

test(analyzers): check the C# analyzer's assertions against samples/facts and correct the fixtures (spec 013 phase 5)
Spec-Runner: spec=013 step=done
@adrian-xping
adrian-xping marked this pull request as ready for review December 3, 2026 23:49
@adrian-xping
adrian-xping merged commit 72c172e into main Dec 3, 2026
5 checks passed
@adrian-xping
adrian-xping deleted the feat/spec-013-csharp-assertion-extraction branch December 3, 2026 23:54
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