Repository navigation
Add VerificationGlue integration tests and a VerificationGlue testing page - #147
Merged
Merged
Conversation
… 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
VerificationGlueVersionin 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:[Mock]toVerificationGlue.Mocks.MockAttribute. Those specs test DependencyModules.Testing's[Mock], so 5 of them failed. The Specs project now setsVerificationGlueMockAliastofalse.[Mock]parameter. That includes the reflection-only signatures in the specs, so the build failed with VGM0001 on private nestedIThinginterfaces. Those three interfaces are nowinternal.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:[Container<SutModule>][Mock]replacing a service, and the next test getting the real one[Mock][TestExport], and[Mock]beating[TestExport][InjectValues]IModuleEnvironmentProviderreaching[IfEnvironment][Shared]with a class-scoped container and per-test mocksCurrentTest, including a startup attribute that sees the running testDependencyModules.Testing.AttributesandVerificationGlue.Mocksand 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 wherecoverage.shandtest-xunit.shrun it, and CI runs both scripts. The comments in those scripts now say so.website/guide/testing-verificationglue.mdis 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:
AttributeUtilitysorts 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 inModuleTestComposition, and this PR makes neither.[Shared]works per service type. In a test with a[Shared] ISingletonServiceparameter, everyISingletonServicein 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%.scripts/test-xunit.sh 4: all the xUnit 4 suites passed. Specs (1156) and the new project (44) passed again withXunitMajor=4.dotnet csharpier check .: clean.npm ci && npm run buildin website/.! grep -rqi verificationglue src --include='*.csproj'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-guideof Tasktsk-verificationglue.