Repository navigation
Report DM0021 for VerificationGlue.Mocks.MockAttribute - #143
Merged
Merged
Conversation
DM0021 recognized only DependencyModules' [Mock], so a VerificationGlue test with VG's [Mock] and a [TestExport] for the same service got no report, though VG gives the parameter the same precedence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p-vgdm-dm0021 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of main moved MockTestExportDiagnosticTests into DependencyModules.Specs, which runs on VerificationGlue.Tests, so the six tests this branch added could not use xUnit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 28, 2026
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
DM0021 now reads
VerificationGlue.Mocks.MockAttributeas well asDependencyModules.Testing.Attributes.MockAttribute. This is step 3 of "Changes, in the order they land" indocs/design/verificationglue.md.KnownTypes.VerificationGlue.Mocks.MockAttributeis new. It is matched by namespace and name, and no shipping project references VerificationGlue.TestAttributeDiagnosticsaccepts either attribute on the parameter. The keyed-mock and Moq exemptions are unchanged.MockTestExportDiagnosticTestshas six new tests with a stub of VerificationGlue's attribute. They check that a VG[Mock]with a[TestExport]on the same method gets the same DM0021 message, severity and location as DependencyModules'[Mock]. They also cover the qualified spelling, a keyed mock, another service, a class-level[TestExport], and aMockAttributein an unrelated namespace.MockAttributesay that under VerificationGlue the parameter is a VerificationGlue mock and needs no mock-support attribute.PublicApiTests.SourceGeneratorApi.verified.txtlists the new publicKnownTypesclass.website/reference/diagnostics.mdand the CHANGELOG mention the second attribute.MicrosoftTestingPlatformEntryPoint.cs, which does not end inProgram.cs, so DM0019 needs no change. The design doc now says so. The other diagnostics in Part 8 (VGT0006, VGT0008, VGM0001) are VerificationGlue changes, and DM0016 needs none.Why
VerificationGlue tests use
VerificationGlue.Mocks.MockAttribute, which has the same precedence over[TestExport]. DM0021 did not recognize it, so DM's analyzer and VG's generator disagreed about[Mock]on VG tests. VG adds no diagnostic of its own for this, so DM0021 is the only report.How it was tested
After the merge with main:
dotnet csharpier check .passes.scripts/coverage.sh 85passes: DependencyModules.Tests (903 per framework), SutProject.Tests (174), SutProject.NUnitTests (46) and WebApiApp.Tests (2) on net8.0 and net10.0, and DependencyModules.Specs (326). Line coverage is 92.9%.scripts/test-xunit.sh 4passes.dotnet build tests/DependencyModules.Tests -c Release --no-incrementalreported no warnings other than NU1902. The merge changed no file of this branch other thanCHANGELOG.md.Not run:
scripts/verify-packages.sh.🤖 Generated with Claude Code
Opened by Agent Driver for step
stp-vgdm-dm0021of Tasktsk-verificationglue.