Conversation
Introduces a new test project, `Moq.AutoMock.Generator.DisableTests`, to verify that individual source generators can be correctly disabled using MSBuild properties. These tests assert that when a generator is explicitly disabled via properties like `EnableMoqAutoMockerOptionsGenerator=false`, its associated generated extension methods are not present in the consuming assembly. A `Moq.AutoMock.props` file is included in the package to make these disable properties visible to the Roslyn compiler, enabling generators to respect them. The CI workflow is updated to build and run these new tests, ensuring continuous validation of the generator disable functionality. `Microsoft.Extensions.DependencyInjection.Abstractions` is also added as a package dependency.
Updates the `dotnet test` command in the build workflow to explicitly use the `--project` flag, improving command reliability. Also, corrects the configuration key from `target` to `applyTo` in the source generator documentation agent. Fixes #406
Uses `VersionOverride` for the local `Moq.AutoMock` package reference to bypass Central Package Management. This ensures that locally-built packages, especially those with CI version suffixes, are correctly resolved in the test project without interference from CPM. Fixes #406
Adjusts NuGet configuration to prioritize local `Moq.AutoMock` package sources, ensuring generator tests consistently use locally-built versions. This setup is crucial for validating generator behavior against specific development builds. Updates the `PackageReference` `VersionOverride` to `*` to reliably match any local package version, including prerelease suffixes often used in CI builds. Fixes #406
Updates the `VersionOverride` for the `Moq.AutoMock` package reference from `*` to `*-*`. This improves matching for both stable and prerelease versions (e.g., `3.6.2-ci0123`) when consuming a locally-built package in CI and local development environments. Fixes #406
This was referenced Mar 16, 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.
Summary
Introduces a new test project to thoroughly verify the functionality of disabling individual Moq.AutoMocker source generators via MSBuild properties.
Motivation
Ensures that consumers of the
Moq.AutoMockNuGet package can successfully opt-out of specific source generator features by setting dedicated MSBuild properties. This provides flexibility and control over the code generation process.Changes
GeneratorTests/Moq.AutoMock.Generator.DisableTests) configured to build with all Moq.AutoMocker generators explicitly disabled.build/Moq.AutoMock.propsfile within theMoq.AutoMockNuGet package to make generator disable properties visible to the Roslyn compiler during package consumption.dotnetcore.yml) to integrate and run these new generator disable tests.Microsoft.Extensions.DependencyInjection.AbstractionstoDirectory.Packages.propsfor the new test project.Moq.AutoMockpackage version.Fixes #406