Skip to content

Add VerificationGlue integration tests and a VerificationGlue testing page - #147

Merged
ipjohnson merged 1 commit into
mainfrom
agent/stp-vgdm-integ-guide
Nov 29, 2026
Merged

ipjohnson merged 1 commit into
mainfrom
agent/stp-vgdm-integ-guide

Conversation

@ipjohnson

Copy link
Copy Markdown
Owner

What changed

  • VerificationGlueVersion in Directory.Build.props goes from 0.5.0-preview.1 to 0.6.0-preview.1. Two changes in 0.6 broke tests/DependencyModules.Specs, and both are fixed:

    • VerificationGlue.Tests now adds a global alias that binds [Mock] to VerificationGlue.Mocks.MockAttribute. Those specs test DependencyModules.Testing's [Mock], so 5 of them failed. The Specs project now sets VerificationGlueMockAlias to false.
    • VerificationGlue.Mocks now generates a mock for every DependencyModules [Mock] parameter. That includes the reflection-only signatures in the specs, so the build failed with VGM0001 on private nested IThing interfaces. Those three interfaces are now internal.
  • New integ-tests/SutProject.VerificationGlueTests (net10.0) has 44 [VerifyTest] tests. It has no adapter package and no [ServiceCollection]. It covers each case from the step:

    • a referenced module by its attribute alone
    • a module declared in the test project
    • an OnlyRealm module
    • [Container<SutModule>]
    • constructor arguments and named properties
    • the circular ModuleA and ModuleB
    • a module named twice registering once
    • [Mock] replacing a service, and the next test getting the real one
    • a keyed [Mock]
    • [TestExport], and [Mock] beating [TestExport]
    • [InjectValues]
    • an IModuleEnvironmentProvider reaching [IfEnvironment]
    • [Shared] with a class-scoped container and per-test mocks
    • CurrentTest, including a startup attribute that sees the running test
    • a file that imports both DependencyModules.Testing.Attributes and VerificationGlue.Mocks and writes [Mock]

    The tests follow the shape of SutProject.Tests and SutProject.NUnitTests.

  • The project is in DependencyModules.sln and in the list in scripts/test-verificationglue.sh. That list is where coverage.sh and test-xunit.sh run it, and CI runs both scripts. The comments in those scripts now say so.

  • website/guide/testing-verificationglue.md is new and is in the sidebar after NUnit. It shows the package references and each case, with code from the new project. It links VerificationGlue's guide and its migration guide. testing.md, README.md and CHANGELOG.md (Unreleased) mention it.

Why

This is step 9 of "Changes, in the order they land" in docs/design/verificationglue.md. VerificationGlue 0.6.0-preview.1 gives [VerifyTest] tests a DependencyModules container from a module attribute alone.

Two differences from DependencyModules.xUnit showed up while writing the tests:

  • Attribute order. On one target, DependencyModules.Testing's AttributeUtility sorts the attributes declared in the test assembly after the others. VerificationGlue keeps the source order. So [FirstRealmModule][SecondarySutModule] resolves differently under each runner. The realm test here writes the attributes in the order that gives the same result under both, and the guide page describes the difference. Making the two runners agree needs a change in VerificationGlue or in ModuleTestComposition, and this PR makes neither.
  • [Shared] works per service type. In a test with a [Shared] ISingletonService parameter, every ISingletonService in that test is the shared one. The page says so.

No project under src/ references VerificationGlue.

How it was tested

These commands were run on the committed tree:

  • dotnet build DependencyModules.sln -c Release: 0 errors.
  • scripts/coverage.sh 85: everything passed. Line coverage was 92.9%.
    • DependencyModules.xUnit.Tests: 72 tests on each of net8.0 and net10.0.
    • SutProject.Tests: 174 on each.
    • SutProject.NUnitTests: 46 on each.
    • WebApiApp.Tests: 2 on each.
    • DependencyModules.Specs: 1156.
    • SutProject.VerificationGlueTests: 44.
  • scripts/test-xunit.sh 4: all the xUnit 4 suites passed. Specs (1156) and the new project (44) passed again with XunitMajor=4.
  • dotnet csharpier check .: clean.
  • The website builds with npm ci && npm run build in website/.
  • All three check commands from the step pass:
    • ! grep -rqi verificationglue src --include='*.csproj'
    • the test for the page and the sidebar entry
    • the grep for the version in Directory.Build.props

Not done: I did not run scripts/verify-packages.sh, because this PR changes no package.

🤖 Generated with Claude Code


Opened by Agent Driver for step stp-vgdm-integ-guide of Task tsk-verificationglue.

… page

Raise VerificationGlueVersion to 0.6.0-preview.1. Its global MockAttribute
alias binds [Mock] to VerificationGlue's attribute, so the Specs, which test
DependencyModules.Testing's [Mock], set VerificationGlueMockAlias to false.
Its mock generator also reads DependencyModules' [Mock], so the IThing
interfaces those specs mock are internal rather than private.

integ-tests/SutProject.VerificationGlueTests runs SutProject's modules under
[VerifyTest] with no adapter package. scripts/test-verificationglue.sh lists
it, so coverage.sh and CI run it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ipjohnson
ipjohnson merged commit 060de29 into main Nov 29, 2026
2 checks passed
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