Skip to content

Commit 28727cb

Browse files
committed
Refines local package resolution for generator tests
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
1 parent a6ff5a1 commit 28727cb

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

GeneratorTests/Moq.AutoMock.Generator.DisableTests/Moq.AutoMock.Generator.DisableTests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@
3333
the packed .nupkg files.
3434
We use VersionOverride to bypass Central Package Management for this package
3535
since we're using a locally-built package with a CI version suffix.
36+
Using * to match any version (including prerelease with -ci suffix in CI).
3637
-->
3738
<ItemGroup Condition="'$(LocalNuGetSource)' != ''">
38-
<PackageReference Include="Moq.AutoMock" VersionOverride="*-*" />
39+
<PackageReference Include="Moq.AutoMock" VersionOverride="*" />
3940
</ItemGroup>
4041

4142
<!-- For local development, use project reference -->
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4+
<!--
5+
For testing the generator disable properties, we need to use the locally-built package.
6+
The local source must be the primary source for Moq.AutoMock.
7+
-->
48
<clear />
5-
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6-
<!-- Local NuGet source for CI testing - path is relative to this file -->
79
<add key="local" value="../../nupkgs" />
10+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
811
</packageSources>
12+
<packageSourceMapping>
13+
<packageSource key="local">
14+
<package pattern="Moq.AutoMock" />
15+
</packageSource>
16+
<packageSource key="nuget.org">
17+
<package pattern="*" />
18+
</packageSource>
19+
</packageSourceMapping>
920
</configuration>

0 commit comments

Comments
 (0)