dependabot-nuget 0.257.0 → 0.259.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/Directory.Packages.props +2 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +2 -2
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +255 -191
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +63 -35
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +107 -14
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +9 -5
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +18 -0
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +6 -1
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +6 -2
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +6 -2
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +11 -21
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +95 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +204 -62
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +64 -45
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +419 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +7 -2
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +77 -19
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +120 -91
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +132 -97
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +93 -75
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +45 -42
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1089 -956
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +1624 -1291
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +296 -293
  27. data/helpers/lib/NuGetUpdater/global.json +6 -0
  28. data/lib/dependabot/nuget/file_parser.rb +4 -5
  29. data/lib/dependabot/nuget/file_updater.rb +1 -1
  30. data/lib/dependabot/nuget/update_checker/dependency_finder.rb +7 -2
  31. data/lib/dependabot/nuget/update_checker/property_updater.rb +1 -0
  32. data/lib/dependabot/nuget/update_checker/version_finder.rb +2 -3
  33. data/lib/dependabot/nuget/update_checker.rb +1 -0
  34. metadata +8 -5
@@ -1,5 +1,3 @@
1
- using System.Collections.Immutable;
2
-
3
1
  using Xunit;
4
2
 
5
3
  namespace NuGetUpdater.Core.Test.Discover;
@@ -12,20 +10,18 @@ public partial class DiscoveryWorkerTests
12
10
  public async Task DiscoversDependencies()
13
11
  {
14
12
  await TestDiscoveryAsync(
13
+ packages:
14
+ [
15
+ MockNuGetPackage.CreateSimplePackage("Package.A", "1.0.0", "net46"),
16
+ MockNuGetPackage.CreateSimplePackage("Package.B", "2.0.0", "net46"),
17
+ ],
15
18
  workspacePath: "",
16
19
  files: [
17
20
  ("packages.config", """
18
21
  <?xml version="1.0" encoding="utf-8"?>
19
22
  <packages>
20
- <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.0" targetFramework="net46" />
21
- <package id="Microsoft.Net.Compilers" version="1.0.1" targetFramework="net46" developmentDependency="true" />
22
- <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
23
- <package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net46" />
24
- <package id="Newtonsoft.Json" version="8.0.3" allowedVersions="[8,10)" targetFramework="net46" />
25
- <package id="NuGet.Core" version="2.11.1" targetFramework="net46" />
26
- <package id="NuGet.Server" version="2.11.2" targetFramework="net46" />
27
- <package id="RouteMagic" version="1.3" targetFramework="net46" />
28
- <package id="WebActivatorEx" version="2.1.0" targetFramework="net46" />
23
+ <package id="Package.A" version="1.0.0" targetFramework="net46" />
24
+ <package id="Package.B" version="2.0.0" targetFramework="net46" />
29
25
  </packages>
30
26
  """),
31
27
  ("myproj.csproj", """
@@ -49,19 +45,13 @@ public partial class DiscoveryWorkerTests
49
45
  TargetFrameworks = ["net46"],
50
46
  Dependencies = [
51
47
  new("Microsoft.NETFramework.ReferenceAssemblies", "1.0.3", DependencyType.Unknown, TargetFrameworks: ["net46"], IsTransitive: true),
52
- new("Microsoft.CodeDom.Providers.DotNetCompilerPlatform", "1.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
53
- new("Microsoft.Net.Compilers", "1.0.1", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
54
- new("Microsoft.Web.Infrastructure", "1.0.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
55
- new("Microsoft.Web.Xdt", "2.1.1", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
56
- new("Newtonsoft.Json", "8.0.3", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
57
- new("NuGet.Core", "2.11.1", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
58
- new("NuGet.Server", "2.11.2", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
59
- new("RouteMagic", "1.3", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
60
- new("WebActivatorEx", "2.1.0", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
48
+ new("Package.A", "1.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
49
+ new("Package.B", "2.0.0", DependencyType.PackagesConfig, TargetFrameworks: ["net46"]),
61
50
  ],
62
51
  }
63
52
  ],
64
- });
53
+ }
54
+ );
65
55
  }
66
56
  }
67
57
  }
@@ -0,0 +1,95 @@
1
+ using Xunit;
2
+
3
+ namespace NuGetUpdater.Core.Test.Discover;
4
+
5
+ public partial class DiscoveryWorkerTests
6
+ {
7
+ public class Proj : DiscoveryWorkerTestBase
8
+ {
9
+ [Theory]
10
+ [InlineData("ProjectFile")]
11
+ [InlineData("ProjectReference")]
12
+ public async Task DirsProjExpansion(string itemType)
13
+ {
14
+ await TestDiscoveryAsync(
15
+ packages: [],
16
+ workspacePath: "dependabot",
17
+ files:
18
+ [
19
+ ("dependabot/projects.proj", $"""
20
+ <Project Sdk="Microsoft.Build.Traversal">
21
+ <ItemGroup>
22
+ <{itemType} Include="..\src\project1\project1.csproj" />
23
+ <{itemType} Include="..\other-dir\dirs.proj" />
24
+ </ItemGroup>
25
+ </Project>
26
+ """),
27
+ ("src/project1/project1.csproj", """
28
+ <Project Sdk="Microsoft.NET.Sdk">
29
+ <PropertyGroup>
30
+ <TargetFramework>net8.0</TargetFramework>
31
+ </PropertyGroup>
32
+ <ItemGroup>
33
+ <PackageReference Include="Package.A" Version="1.0.0" />
34
+ </ItemGroup>
35
+ </Project>
36
+ """),
37
+ ("other-dir/dirs.proj", $"""
38
+ <Project Sdk="Microsoft.Build.Traversal">
39
+ <ItemGroup>
40
+ <{itemType} Include="..\src\project2\project2.csproj" />
41
+ </ItemGroup>
42
+ </Project>
43
+ """),
44
+ ("src/project2/project2.csproj", """
45
+ <Project Sdk="Microsoft.NET.Sdk">
46
+ <PropertyGroup>
47
+ <TargetFramework>net8.0</TargetFramework>
48
+ </PropertyGroup>
49
+ <ItemGroup>
50
+ <PackageReference Include="Package.B" Version="2.0.0" />
51
+ </ItemGroup>
52
+ </Project>
53
+ """),
54
+ ],
55
+ expectedResult: new()
56
+ {
57
+ FilePath = "dependabot",
58
+ Projects =
59
+ [
60
+ new()
61
+ {
62
+ FilePath = "../src/project1/project1.csproj",
63
+ ExpectedDependencyCount = 2,
64
+ Dependencies =
65
+ [
66
+ new("Package.A", "1.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
67
+ ],
68
+ Properties =
69
+ [
70
+ new("TargetFramework", "net8.0", "src/project1/project1.csproj")
71
+ ],
72
+ TargetFrameworks = ["net8.0"],
73
+ ReferencedProjectPaths = []
74
+ },
75
+ new()
76
+ {
77
+ FilePath = "../src/project2/project2.csproj",
78
+ ExpectedDependencyCount = 2,
79
+ Dependencies =
80
+ [
81
+ new("Package.B", "2.0.0", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
82
+ ],
83
+ Properties =
84
+ [
85
+ new("TargetFramework", "net8.0", "src/project2/project2.csproj")
86
+ ],
87
+ TargetFrameworks = ["net8.0"],
88
+ ReferencedProjectPaths = []
89
+ }
90
+ ]
91
+ }
92
+ );
93
+ }
94
+ }
95
+ }