dependabot-nuget 0.263.0 → 0.264.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +37 -0
  3. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +3 -3
  4. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +1 -0
  5. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +169 -0
  6. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +79 -67
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +0 -4
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +10 -11
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalysisResult.cs +11 -0
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +441 -0
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +177 -0
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +47 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyInfo.cs +12 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Extensions.cs +36 -0
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +128 -0
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Requirement.cs +105 -0
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs +17 -0
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerability.cs +11 -0
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerabilityExtensions.cs +36 -0
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +179 -0
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionResult.cs +54 -0
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +5 -2
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +2 -1
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +2 -2
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +0 -2
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +0 -3
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +0 -3
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +0 -5
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +0 -4
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +6 -2
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs +0 -4
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs +0 -2
  33. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs +0 -2
  34. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +0 -4
  35. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +0 -3
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +7 -8
  37. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +0 -4
  38. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +0 -3
  39. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +0 -4
  40. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +90 -0
  41. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +304 -0
  42. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs +145 -0
  43. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/ExpectedAnalysisResult.cs +8 -0
  44. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/RequirementTests.cs +69 -0
  45. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/SecurityVulnerabilityExtensionsTests.cs +78 -0
  46. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/VersionFinderTests.cs +193 -0
  47. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -2
  48. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +2 -2
  49. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +2 -2
  50. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +1 -1
  51. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +1 -1
  52. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +102 -9
  53. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +4 -4
  54. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +2 -2
  55. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +8 -2
  56. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +2 -1
  57. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +8 -7
  58. data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +63 -0
  59. data/lib/dependabot/nuget/analysis/dependency_analysis.rb +63 -0
  60. data/lib/dependabot/nuget/file_fetcher.rb +7 -6
  61. data/lib/dependabot/nuget/file_parser.rb +28 -21
  62. data/lib/dependabot/nuget/file_updater.rb +22 -25
  63. data/lib/dependabot/nuget/metadata_finder.rb +2 -160
  64. data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +102 -0
  65. data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +129 -0
  66. data/lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb +44 -0
  67. data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +174 -0
  68. data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +63 -0
  69. data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +82 -0
  70. data/lib/dependabot/nuget/native_discovery/native_property_details.rb +43 -0
  71. data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +68 -0
  72. data/lib/dependabot/nuget/native_helpers.rb +59 -0
  73. data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +105 -0
  74. data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +200 -0
  75. data/lib/dependabot/nuget/nuget_config_credential_helpers.rb +3 -2
  76. data/lib/dependabot/nuget/update_checker.rb +47 -0
  77. metadata +39 -5
@@ -0,0 +1,8 @@
1
+ using NuGetUpdater.Core.Analyze;
2
+
3
+ namespace NuGetUpdater.Core.Test.Analyze;
4
+
5
+ public record ExpectedAnalysisResult : AnalysisResult
6
+ {
7
+ public int? ExpectedUpdatedDependenciesCount { get; init; }
8
+ }
@@ -0,0 +1,69 @@
1
+ using NuGet.Versioning;
2
+
3
+ using NuGetUpdater.Core.Analyze;
4
+
5
+ using Xunit;
6
+
7
+ namespace NuGetUpdater.Core.Test.Analyze;
8
+
9
+ public class RequirementTests
10
+ {
11
+ // Supported OPs (=, !=, >, <, >=, <=, ~>)
12
+ [Theory]
13
+ [InlineData("1.0.0", "1.0.0", true)]
14
+ [InlineData("1.0.0-alpha", "1.0.0", false)]
15
+ [InlineData("1.0.0", "= 1.0.0", true)]
16
+ [InlineData("1.0.0-alpha", "= 1.0.0", false)]
17
+ [InlineData("1.0.0", "!=1.0.1", true)]
18
+ [InlineData("1.0.0", "!= 1.0.0", false)]
19
+ [InlineData("1.0.1", "> 1.0.0", true)]
20
+ [InlineData("1.0.0-alpha", "> 1.0.0", false)]
21
+ [InlineData("1.0.0", "< 1.0.1", true)]
22
+ [InlineData("1.0.0", "<1.0.0-alpha", false)]
23
+ [InlineData("1.0.0", ">= 1.0.0", true)]
24
+ [InlineData("1.0.1", ">= 1.0.0", true)]
25
+ [InlineData("1.0.0-alpha", ">= 1.0.0", false)]
26
+ [InlineData("1.0.0", "<= 1.0.0", true)]
27
+ [InlineData("1.0.0-alpha", "<= 1.0.0", true)]
28
+ [InlineData("1.0.1", "<= 1.0.0", false)]
29
+ [InlineData("1.0.1", "~>1.0.0", true)]
30
+ [InlineData("1.1.0", "~> 1.0.0", false)]
31
+ [InlineData("1.1", "~> 1.0", true)]
32
+ [InlineData("2.0", "~> 1.0", false)]
33
+ [InlineData("1", "~> 1", true)]
34
+ [InlineData("2", "~> 1", false)]
35
+ public void IsSatisfiedBy(string versionString, string requirementString, bool expected)
36
+ {
37
+ var version = NuGetVersion.Parse(versionString);
38
+ var requirement = Requirement.Parse(requirementString);
39
+
40
+ var actual = requirement.IsSatisfiedBy(version);
41
+
42
+ Assert.Equal(expected, actual);
43
+ }
44
+
45
+ [Theory]
46
+ [InlineData("> = 1.0.0")] // Invalid format
47
+ [InlineData("<>= 1.0.0")] // Invalid Operator
48
+ [InlineData(">")] // Missing version
49
+ public void Parse_ThrowsForInvalid(string requirementString)
50
+ {
51
+ Assert.Throws<ArgumentException>(() => Requirement.Parse(requirementString));
52
+ }
53
+
54
+ [Theory]
55
+ [InlineData("1.0.0-alpha", "1.1.0.0")]
56
+ [InlineData("1.0.0.0", "1.0.1.0")]
57
+ [InlineData("1.0.0", "1.1.0.0")]
58
+ [InlineData("1.0", "2.0.0.0")]
59
+ [InlineData("1", "2.0.0.0")]
60
+ public void Bump(string versionString, string expectedString)
61
+ {
62
+ var version = NuGetVersion.Parse(versionString);
63
+ var expected = Version.Parse(expectedString);
64
+
65
+ var actual = Requirement.Bump(version);
66
+
67
+ Assert.Equal(expected, actual);
68
+ }
69
+ }
@@ -0,0 +1,78 @@
1
+ using NuGet.Versioning;
2
+
3
+ using NuGetUpdater.Core.Analyze;
4
+
5
+ using Xunit;
6
+
7
+ namespace NuGetUpdater.Core.Test.Analyze;
8
+
9
+ public class SecurityVulnerabilityExtensionsTests
10
+ {
11
+ [Fact]
12
+ public void VersionInSafeVersions_IsNotVulnerable()
13
+ {
14
+ var version = NuGetVersion.Parse("1.0.1");
15
+ var vulnerability = new SecurityVulnerability
16
+ {
17
+ DependencyName = "Dependency",
18
+ PackageManager = "PackageManager",
19
+ SafeVersions = [Requirement.Parse("> 1.0.0")],
20
+ VulnerableVersions = [Requirement.Parse("<= 1.0.0")],
21
+ };
22
+
23
+ var result = vulnerability.IsVulnerable(version);
24
+
25
+ Assert.False(result);
26
+ }
27
+
28
+ [Fact]
29
+ public void VersionInVulnerableVersions_IsVulnerable()
30
+ {
31
+ var version = NuGetVersion.Parse("1.0.0");
32
+ var vulnerability = new SecurityVulnerability
33
+ {
34
+ DependencyName = "Dependency",
35
+ PackageManager = "PackageManager",
36
+ SafeVersions = [Requirement.Parse("> 1.0.0")],
37
+ VulnerableVersions = [Requirement.Parse("<= 1.0.0")],
38
+ };
39
+
40
+ var result = vulnerability.IsVulnerable(version);
41
+
42
+ Assert.True(result);
43
+ }
44
+
45
+ [Fact]
46
+ public void VersionNotInVulnerableVersions_IsNotVulnerable()
47
+ {
48
+ var version = NuGetVersion.Parse("1.0.1");
49
+ var vulnerability = new SecurityVulnerability
50
+ {
51
+ DependencyName = "Dependency",
52
+ PackageManager = "PackageManager",
53
+ SafeVersions = [],
54
+ VulnerableVersions = [Requirement.Parse("<= 1.0.0")],
55
+ };
56
+
57
+ var result = vulnerability.IsVulnerable(version);
58
+
59
+ Assert.False(result);
60
+ }
61
+
62
+ [Fact]
63
+ public void VersionNotInSafeVersions_IsVulnerable()
64
+ {
65
+ var version = NuGetVersion.Parse("1.0.0");
66
+ var vulnerability = new SecurityVulnerability
67
+ {
68
+ DependencyName = "Dependency",
69
+ PackageManager = "PackageManager",
70
+ SafeVersions = [Requirement.Parse("> 1.0.0")],
71
+ VulnerableVersions = [],
72
+ };
73
+
74
+ var result = vulnerability.IsVulnerable(version);
75
+
76
+ Assert.True(result);
77
+ }
78
+ }
@@ -0,0 +1,193 @@
1
+ using NuGet.Versioning;
2
+
3
+ using NuGetUpdater.Core.Analyze;
4
+
5
+ using Xunit;
6
+
7
+ namespace NuGetUpdater.Core.Test.Analyze;
8
+
9
+ public class VersionFinderTests
10
+ {
11
+ [Fact]
12
+ public void VersionFilter_VersionInIgnoredVersions_ReturnsFalse()
13
+ {
14
+ var dependencyInfo = new DependencyInfo
15
+ {
16
+ Name = "Dependency",
17
+ Version = "0.8.0",
18
+ IsVulnerable = false,
19
+ IgnoredVersions = [Requirement.Parse("< 1.0.0")],
20
+ Vulnerabilities = [],
21
+ };
22
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
23
+ var version = NuGetVersion.Parse("0.9.0");
24
+
25
+ var result = filter(version);
26
+
27
+ Assert.False(result);
28
+ }
29
+
30
+ [Fact]
31
+ public void VersionFilter_VersionNotInIgnoredVersions_ReturnsTrue()
32
+ {
33
+ var dependencyInfo = new DependencyInfo
34
+ {
35
+ Name = "Dependency",
36
+ Version = "0.8.0",
37
+ IsVulnerable = false,
38
+ IgnoredVersions = [Requirement.Parse("< 1.0.0")],
39
+ Vulnerabilities = [],
40
+ };
41
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
42
+ var version = NuGetVersion.Parse("1.0.1");
43
+
44
+ var result = filter(version);
45
+
46
+ Assert.True(result);
47
+ }
48
+
49
+ [Fact]
50
+ public void VersionFilter_VersionInVulnerabilities_ReturnsFalse()
51
+ {
52
+ var dependencyInfo = new DependencyInfo
53
+ {
54
+ Name = "Dependency",
55
+ Version = "0.8.0",
56
+ IsVulnerable = false,
57
+ IgnoredVersions = [],
58
+ Vulnerabilities = [new()
59
+ {
60
+ DependencyName = "Dependency",
61
+ PackageManager = "PackageManager",
62
+ SafeVersions = [],
63
+ VulnerableVersions = [Requirement.Parse("< 1.0.0")],
64
+ }],
65
+ };
66
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
67
+ var version = NuGetVersion.Parse("0.9.0");
68
+
69
+ var result = filter(version);
70
+
71
+ Assert.False(result);
72
+ }
73
+
74
+ [Fact]
75
+ public void VersionFilter_VersionNotInVulnerabilities_ReturnsTrue()
76
+ {
77
+ var dependencyInfo = new DependencyInfo
78
+ {
79
+ Name = "Dependency",
80
+ Version = "0.8.0",
81
+ IsVulnerable = false,
82
+ IgnoredVersions = [],
83
+ Vulnerabilities = [new()
84
+ {
85
+ DependencyName = "Dependency",
86
+ PackageManager = "PackageManager",
87
+ SafeVersions = [],
88
+ VulnerableVersions = [Requirement.Parse("< 1.0.0")],
89
+ }],
90
+ };
91
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
92
+ var version = NuGetVersion.Parse("1.0.1");
93
+
94
+ var result = filter(version);
95
+
96
+ Assert.True(result);
97
+ }
98
+
99
+ [Fact]
100
+ public void VersionFilter_VersionLessThanCurrentVersion_ReturnsFalse()
101
+ {
102
+ var dependencyInfo = new DependencyInfo
103
+ {
104
+ Name = "Dependency",
105
+ Version = "1.0.0",
106
+ IsVulnerable = false,
107
+ IgnoredVersions = [],
108
+ Vulnerabilities = [],
109
+ };
110
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
111
+ var version = NuGetVersion.Parse("0.9.0");
112
+
113
+ var result = filter(version);
114
+
115
+ Assert.False(result);
116
+ }
117
+
118
+ [Fact]
119
+ public void VersionFilter_VersionHigherThanCurrentVersion_ReturnsTrue()
120
+ {
121
+ var dependencyInfo = new DependencyInfo
122
+ {
123
+ Name = "Dependency",
124
+ Version = "1.0.0",
125
+ IsVulnerable = false,
126
+ IgnoredVersions = [],
127
+ Vulnerabilities = [],
128
+ };
129
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
130
+ var version = NuGetVersion.Parse("1.0.1");
131
+
132
+ var result = filter(version);
133
+
134
+ Assert.True(result);
135
+ }
136
+
137
+ [Fact]
138
+ public void VersionFilter_PreviewVersionDifferentThanCurrentVersion_ReturnsFalse()
139
+ {
140
+ var dependencyInfo = new DependencyInfo
141
+ {
142
+ Name = "Dependency",
143
+ Version = "1.0.0-alpha",
144
+ IsVulnerable = false,
145
+ IgnoredVersions = [],
146
+ Vulnerabilities = [],
147
+ };
148
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
149
+ var version = NuGetVersion.Parse("1.0.1-beta");
150
+
151
+ var result = filter(version);
152
+
153
+ Assert.False(result);
154
+ }
155
+
156
+ [Fact]
157
+ public void VersionFilter_PreviewVersionSameAsCurrentVersion_ReturnsTrue()
158
+ {
159
+ var dependencyInfo = new DependencyInfo
160
+ {
161
+ Name = "Dependency",
162
+ Version = "1.0.0-alpha",
163
+ IsVulnerable = false,
164
+ IgnoredVersions = [],
165
+ Vulnerabilities = [],
166
+ };
167
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
168
+ var version = NuGetVersion.Parse("1.0.0-beta");
169
+
170
+ var result = filter(version);
171
+
172
+ Assert.True(result);
173
+ }
174
+
175
+ [Fact]
176
+ public void VersionFilter_WildcardPreviewVersion_ReturnsTrue()
177
+ {
178
+ var dependencyInfo = new DependencyInfo
179
+ {
180
+ Name = "Dependency",
181
+ Version = "*-*",
182
+ IsVulnerable = false,
183
+ IgnoredVersions = [],
184
+ Vulnerabilities = [],
185
+ };
186
+ var filter = VersionFinder.CreateVersionFilter(dependencyInfo, VersionRange.Parse(dependencyInfo.Version));
187
+ var version = NuGetVersion.Parse("1.0.0-beta");
188
+
189
+ var result = filter(version);
190
+
191
+ Assert.True(result);
192
+ }
193
+ }
@@ -7,7 +7,6 @@ using NuGetUpdater.Core.Test.Update;
7
7
  using NuGetUpdater.Core.Test.Utilities;
8
8
 
9
9
  using Xunit;
10
- using Xunit.Sdk;
11
10
 
12
11
  namespace NuGetUpdater.Core.Test.Discover;
13
12
 
@@ -35,7 +34,7 @@ public class DiscoveryWorkerTestBase
35
34
  protected static void ValidateWorkspaceResult(ExpectedWorkspaceDiscoveryResult expectedResult, WorkspaceDiscoveryResult actualResult)
36
35
  {
37
36
  Assert.NotNull(actualResult);
38
- Assert.Equal(expectedResult.FilePath.NormalizePathToUnix(), actualResult.FilePath.NormalizePathToUnix());
37
+ Assert.Equal(expectedResult.Path.NormalizePathToUnix(), actualResult.Path.NormalizePathToUnix());
39
38
  ValidateDirectoryPackagesProps(expectedResult.DirectoryPackagesProps, actualResult.DirectoryPackagesProps);
40
39
  ValidateResultWithDependencies(expectedResult.GlobalJson, actualResult.GlobalJson);
41
40
  ValidateResultWithDependencies(expectedResult.DotNetToolsJson, actualResult.DotNetToolsJson);
@@ -36,7 +36,7 @@ public partial class DiscoveryWorkerTests
36
36
  ],
37
37
  expectedResult: new()
38
38
  {
39
- FilePath = "",
39
+ Path = "",
40
40
  DotNetToolsJson = new()
41
41
  {
42
42
  FilePath = ".config/dotnet-tools.json",
@@ -80,7 +80,7 @@ public partial class DiscoveryWorkerTests
80
80
  ],
81
81
  expectedResult: new()
82
82
  {
83
- FilePath = "",
83
+ Path = "",
84
84
  DotNetToolsJson = new()
85
85
  {
86
86
  FilePath = ".config/dotnet-tools.json",
@@ -26,7 +26,7 @@ public partial class DiscoveryWorkerTests
26
26
  ],
27
27
  expectedResult: new()
28
28
  {
29
- FilePath = "",
29
+ Path = "",
30
30
  GlobalJson = new()
31
31
  {
32
32
  FilePath = "global.json",
@@ -60,7 +60,7 @@ public partial class DiscoveryWorkerTests
60
60
  ],
61
61
  expectedResult: new()
62
62
  {
63
- FilePath = "",
63
+ Path = "",
64
64
  GlobalJson = new()
65
65
  {
66
66
  FilePath = "global.json",
@@ -34,7 +34,7 @@ public partial class DiscoveryWorkerTests
34
34
  ],
35
35
  expectedResult: new()
36
36
  {
37
- FilePath = "",
37
+ Path = "",
38
38
  Projects = [
39
39
  new()
40
40
  {
@@ -54,7 +54,7 @@ public partial class DiscoveryWorkerTests
54
54
  ],
55
55
  expectedResult: new()
56
56
  {
57
- FilePath = "dependabot",
57
+ Path = "dependabot",
58
58
  Projects =
59
59
  [
60
60
  new()
@@ -37,7 +37,7 @@ public partial class DiscoveryWorkerTests
37
37
  ],
38
38
  expectedResult: new()
39
39
  {
40
- FilePath = "",
40
+ Path = "",
41
41
  Projects = [
42
42
  new()
43
43
  {
@@ -108,7 +108,7 @@ public partial class DiscoveryWorkerTests
108
108
  ],
109
109
  expectedResult: new()
110
110
  {
111
- FilePath = "",
111
+ Path = "",
112
112
  ExpectedProjectCount = 2,
113
113
  Projects = [
114
114
  new()
@@ -189,7 +189,7 @@ public partial class DiscoveryWorkerTests
189
189
  ],
190
190
  expectedResult: new()
191
191
  {
192
- FilePath = "",
192
+ Path = "",
193
193
  Projects = [
194
194
  new()
195
195
  {
@@ -299,7 +299,7 @@ public partial class DiscoveryWorkerTests
299
299
  ],
300
300
  expectedResult: new()
301
301
  {
302
- FilePath = "",
302
+ Path = "",
303
303
  ExpectedProjectCount = 5,
304
304
  Projects = [
305
305
  new()
@@ -365,7 +365,7 @@ public partial class DiscoveryWorkerTests
365
365
  ],
366
366
  expectedResult: new()
367
367
  {
368
- FilePath = "",
368
+ Path = "",
369
369
  Projects = [
370
370
  new()
371
371
  {
@@ -386,6 +386,59 @@ public partial class DiscoveryWorkerTests
386
386
  );
387
387
  }
388
388
 
389
+ [Fact]
390
+ public async Task TargetFrameworkCanBeResolvedFromImplicitlyImportedFile()
391
+ {
392
+ await TestDiscoveryAsync(
393
+ packages: [],
394
+ workspacePath: "",
395
+ files: [
396
+ ("myproj.csproj", """
397
+ <Project Sdk="Microsoft.NET.Sdk">
398
+ <PropertyGroup>
399
+ <TargetFramework>$(SomeTfm)</TargetFramework>
400
+ </PropertyGroup>
401
+ <ItemGroup>
402
+ <PackageReference Include="Package.A" Version="1.2.3" />
403
+ </ItemGroup>
404
+ </Project>
405
+ """),
406
+ ("Directory.Build.props", """
407
+ <Project>
408
+ <PropertyGroup>
409
+ <SomeTfm>net8.0</SomeTfm>
410
+ </PropertyGroup>
411
+ </Project>
412
+ """)
413
+ ],
414
+ expectedResult: new()
415
+ {
416
+ Path = "",
417
+ Projects = [
418
+ new()
419
+ {
420
+ FilePath = "Directory.Build.props",
421
+ Dependencies = [],
422
+ },
423
+ new()
424
+ {
425
+ FilePath = "myproj.csproj",
426
+ ExpectedDependencyCount = 2,
427
+ Dependencies = [
428
+ new("Package.A", "1.2.3", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
429
+ ],
430
+ Properties = [
431
+ new("SomeTfm", "net8.0", "Directory.Build.props"),
432
+ new("TargetFramework", "$(SomeTfm)", "myproj.csproj"),
433
+ ],
434
+ TargetFrameworks = ["net8.0"],
435
+ ReferencedProjectPaths = [],
436
+ }
437
+ ]
438
+ }
439
+ );
440
+ }
441
+
389
442
  [Fact]
390
443
 
391
444
  public async Task NoDependenciesReturnedIfNoTargetFrameworkCanBeResolved()
@@ -407,12 +460,52 @@ public partial class DiscoveryWorkerTests
407
460
  ],
408
461
  expectedResult: new()
409
462
  {
410
- FilePath = "",
463
+ Path = "",
411
464
  Projects = []
412
465
  }
413
466
  );
414
467
  }
415
468
 
469
+ [Fact]
470
+ public async Task PropertyWithWildcardVersionIsRetained()
471
+ {
472
+ await TestDiscoveryAsync(
473
+ packages: [],
474
+ workspacePath: "",
475
+ files: [
476
+ ("myproj.csproj", """
477
+ <Project Sdk="Microsoft.NET.Sdk">
478
+ <PropertyGroup>
479
+ <TargetFramework>net8.0</TargetFramework>
480
+ </PropertyGroup>
481
+ <ItemGroup>
482
+ <PackageReference Include="Some.Package" Version="1.*" />
483
+ </ItemGroup>
484
+ </Project>
485
+ """)
486
+ ],
487
+ expectedResult: new()
488
+ {
489
+ Path = "",
490
+ Projects = [
491
+ new()
492
+ {
493
+ FilePath = "myproj.csproj",
494
+ ExpectedDependencyCount = 2,
495
+ Dependencies = [
496
+ new("Some.Package", "1.*", DependencyType.PackageReference, TargetFrameworks: ["net8.0"], IsDirect: true),
497
+ ],
498
+ Properties = [
499
+ new("TargetFramework", "net8.0", "myproj.csproj"),
500
+ ],
501
+ TargetFrameworks = ["net8.0"],
502
+ ReferencedProjectPaths = [],
503
+ }
504
+ ]
505
+ }
506
+ );
507
+ }
508
+
416
509
  [Fact]
417
510
  public async Task DiscoverReportsTransitivePackageVersionsWithFourPartsForMultipleTargetFrameworks()
418
511
  {
@@ -438,7 +531,7 @@ public partial class DiscoveryWorkerTests
438
531
  ],
439
532
  expectedResult: new()
440
533
  {
441
- FilePath = "",
534
+ Path = "",
442
535
  Projects = [
443
536
  new()
444
537
  {
@@ -493,7 +586,7 @@ public partial class DiscoveryWorkerTests
493
586
  ],
494
587
  expectedResult: new()
495
588
  {
496
- FilePath = "test",
589
+ Path = "test",
497
590
  Projects = [
498
591
  new()
499
592
  {
@@ -569,7 +662,7 @@ public partial class DiscoveryWorkerTests
569
662
  ],
570
663
  expectedResult: new()
571
664
  {
572
- FilePath = "solutions",
665
+ Path = "solutions",
573
666
  Projects = [
574
667
  new()
575
668
  {
@@ -33,7 +33,7 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
33
33
  },
34
34
  expectedResult: new()
35
35
  {
36
- FilePath = "src",
36
+ Path = "src",
37
37
  Projects = [
38
38
  new()
39
39
  {
@@ -92,7 +92,7 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
92
92
  },
93
93
  expectedResult: new()
94
94
  {
95
- FilePath = "src",
95
+ Path = "src",
96
96
  Projects = [
97
97
  new()
98
98
  {
@@ -151,7 +151,7 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
151
151
  },
152
152
  expectedResult: new()
153
153
  {
154
- FilePath = "src",
154
+ Path = "src",
155
155
  ExpectedProjectCount = 2,
156
156
  Projects = [
157
157
  new()
@@ -276,7 +276,7 @@ public partial class DiscoveryWorkerTests : DiscoveryWorkerTestBase
276
276
  },
277
277
  expectedResult: new()
278
278
  {
279
- FilePath = "",
279
+ Path = "",
280
280
  ExpectedProjectCount = 2,
281
281
  Projects = [
282
282
  new()
@@ -4,9 +4,9 @@ using NuGetUpdater.Core.Discover;
4
4
 
5
5
  namespace NuGetUpdater.Core.Test.Discover;
6
6
 
7
- public record ExpectedWorkspaceDiscoveryResult : IDiscoveryResult
7
+ public record ExpectedWorkspaceDiscoveryResult
8
8
  {
9
- public required string FilePath { get; init; }
9
+ public required string Path { get; init; }
10
10
  public bool IsSuccess { get; init; } = true;
11
11
  public ImmutableArray<ExpectedSdkProjectDiscoveryResult> Projects { get; init; }
12
12
  public int? ExpectedProjectCount { get; init; }
@@ -71,12 +71,18 @@ namespace NuGetUpdater.Core.Test
71
71
  /// Creates a mock NuGet package with a single assembly in the appropriate `lib/` directory. The assembly will
72
72
  /// be empty.
73
73
  /// </summary>
74
- public static MockNuGetPackage CreateSimplePackage(string id, string version, string targetFramework, (string? TargetFramework, (string Id, string Version)[] Packages)[]? dependencyGroups = null)
74
+ public static MockNuGetPackage CreateSimplePackage(
75
+ string id,
76
+ string version,
77
+ string targetFramework,
78
+ (string? TargetFramework, (string Id, string Version)[] Packages)[]? dependencyGroups = null,
79
+ XElement[]? additionalMetadata = null
80
+ )
75
81
  {
76
82
  return new(
77
83
  id,
78
84
  version,
79
- AdditionalMetadata: null,
85
+ AdditionalMetadata: additionalMetadata,
80
86
  DependencyGroups: dependencyGroups,
81
87
  Files:
82
88
  [