Skip to content

Move the framework-free TestingTests to DependencyModules.Specs - #138

Merged
ipjohnson merged 3 commits into
mainfrom
agent/stp-vgdm-testing-tests
Nov 27, 2026
Merged

ipjohnson merged 3 commits into
mainfrom
agent/stp-vgdm-testing-tests

Conversation

@ipjohnson

Copy link
Copy Markdown
Owner

What changed

Five files move from tests/DependencyModules.Tests/TestingTests to tests/DependencyModules.Specs/TestingTests. Each one now runs on the [VerifyTest] runner:

  • SharedRegistrationsTests.cs (12 tests)
  • TestContainerSourceUnitTests.cs (10 tests)
  • TestExportAttributeTests.cs (10 tests, 3 of them rows)
  • TestOutputLoggerProviderTests.cs (12 tests, 6 of them rows)
  • TestParameterResolverTests.cs (15 tests)

[Fact] is now [VerifyTest], and [Theory] with [InlineData] is now [VerifyTest] with [Row]. The Assert calls are now Verify, Single, Is<T>, ThrowsExactly and ThrowsExactlyAsync, with the same forms that #136 used. Assert.IsType<T> is now a GetType() == typeof(T) check, so it stays an exact-type check. The classes are partial and are in the DependencyModules.Specs.TestingTests namespace. All 59 tests still exist, with the same names.

CONTRIBUTING.md now says that TestingTests is in the Specs project, and that some of its tests stay in the old project.

Tests that stay on xUnit

tests/DependencyModules.Tests/TestingTests/TestContainerSourceTests.cs stays in the old project. All of its tests are [ModuleTest] tests from DependencyModules.xUnit. They test ITestContainerSource and [TestExport] sharing through the xUnit integration, so they need the xUnit runner:

  • TestContainerSourceTests: ABareParameterIsTheSameObjectInEveryContainer, EachContainerGetsItsOwnApplicationSingleton, AMockIsTheSameObjectInEveryContainer, TheTestsOwnContainerHoldsTheSameMock, EveryCallBuildsAContainer, TheKeyedRegistrationsOfAPinnedTypeAreKept, SharedOnAValueParameterIsRedundant
  • IsolatedTestExportTests: AnExportIsRebuiltWithEachContainer
  • SharedTestExportTests: AnExportAskingToBeSharedCrossesEveryContainer, SharedOverridesATransientLifetime
  • UnsharableTestExportTests: ASharedExportTheTestsContainerCannotProduceIsReported

This PR does not change GeneratorTests.

Why

DependencyModules' own unit tests are moving to the [VerifyTest] runner, so that a failed check shows its expression and values. Only tests of the xUnit or NUnit integration stay on xUnit.

How it was tested

  • dotnet build DependencyModules.sln --configuration Release builds with no errors.
  • ./scripts/coverage.sh 85 passes. DependencyModules.Tests passed 1003 tests on net8.0 and on net10.0. DependencyModules.Specs passed 183 tests. Line coverage is 92.8 percent.
  • ./scripts/test-xunit.sh 4 passes, DependencyModules.Specs with XunitMajor=4 included.
  • --list-tests on the Specs application lists 59 tests from the five moved classes. That is the count of [Fact] and [InlineData] rows in the old files.
  • dotnet csharpier check . passes.

🤖 Generated with Claude Code


Opened by Agent Driver for step stp-vgdm-testing-tests of Task tsk-verificationglue.

Convert SharedRegistrationsTests, TestContainerSourceUnitTests,
TestExportAttributeTests, TestOutputLoggerProviderTests and
TestParameterResolverTests to [VerifyTest] with Row and Verify checks.
TestContainerSourceTests stays in DependencyModules.Tests, because its
tests run through [ModuleTest] and the xUnit integration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SetupServiceCollection keyed the value providers by the ParameterInfo objects of one
GetParameters call, and ResolveArgumentsAsync looked them up with another. When tests run in
parallel, two first calls on the same method can return different arrays, and the lookup throws
KeyNotFoundException.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ipjohnson

Copy link
Copy Markdown
Owner Author

Commit 269bfea fixes the CI failure of AMockOnAParameter_BeatsARegistrationMadeBeforeIt (KeyNotFoundException at TestParameterResolver.cs:131). TestParameterResolver keyed its value providers by the ParameterInfo objects of one GetParameters() call and looked them up with another. When the VerificationGlue runner runs tests in parallel, two first calls on the same method can return different arrays. The resolver now reads the parameters once in its constructor.

Before the fix, the Specs project failed this test in 3 of 40 local runs. After it, 100 of 100 runs passed, and ./scripts/coverage.sh 85 passed at 92.8%. CI will still fail the coverage step until #140 is merged, because coverlet reports 0% for the Specs project in CI builds.

@ipjohnson
ipjohnson merged commit 34246a5 into main Nov 27, 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