dependabot-nuget 0.258.0 → 0.260.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.Threading.Tasks;
2
-
3
1
  using Xunit;
4
2
 
5
3
  namespace NuGetUpdater.Core.Test.Update;
@@ -11,37 +9,51 @@ public partial class UpdateWorkerTests
11
9
  [Fact]
12
10
  public async Task NoChangeWhenDotNetToolsJsonNotFound()
13
11
  {
14
- await TestNoChangeforProject("Microsoft.BotSay", "1.0.0", "1.1.0",
12
+ await TestNoChangeforProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
13
+ packages:
14
+ [
15
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
16
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
17
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
18
+ ],
15
19
  // initial
16
20
  projectContents: """
17
- <Project Sdk="Microsoft.NET.Sdk">
18
- <PropertyGroup>
19
- <TargetFramework>netstandard2.0</TargetFramework>
20
- </PropertyGroup>
21
+ <Project Sdk="Microsoft.NET.Sdk">
22
+ <PropertyGroup>
23
+ <TargetFramework>net8.0</TargetFramework>
24
+ </PropertyGroup>
21
25
 
22
- <ItemGroup>
23
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
24
- </ItemGroup>
25
- </Project>
26
- """);
26
+ <ItemGroup>
27
+ <PackageReference Include="Some.Package" Version="13.0.3" />
28
+ </ItemGroup>
29
+ </Project>
30
+ """
31
+ );
27
32
  }
28
33
 
29
34
  [Fact]
30
35
  public async Task NoChangeWhenDependencyNotFound()
31
36
  {
32
- await TestNoChangeforProject("Microsoft.BotSay", "1.0.0", "1.1.0",
37
+ await TestNoChangeforProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
38
+ packages:
39
+ [
40
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
41
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
42
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
43
+ MockNuGetPackage.CreateDotNetToolPackage("Some-Other-Tool", "2.0.0", "net8.0"),
44
+ ],
33
45
  // initial
34
46
  projectContents: """
35
- <Project Sdk="Microsoft.NET.Sdk">
36
- <PropertyGroup>
37
- <TargetFramework>netstandard2.0</TargetFramework>
38
- </PropertyGroup>
47
+ <Project Sdk="Microsoft.NET.Sdk">
48
+ <PropertyGroup>
49
+ <TargetFramework>net8.0</TargetFramework>
50
+ </PropertyGroup>
39
51
 
40
- <ItemGroup>
41
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
42
- </ItemGroup>
43
- </Project>
44
- """,
52
+ <ItemGroup>
53
+ <PackageReference Include="Some.Package" Version="13.0.3" />
54
+ </ItemGroup>
55
+ </Project>
56
+ """,
45
57
  additionalFiles:
46
58
  [
47
59
  (".config/dotnet-tools.json", """
@@ -49,35 +61,43 @@ public partial class UpdateWorkerTests
49
61
  "version": 1,
50
62
  "isRoot": true,
51
63
  "tools": {
52
- "dotnetsay": {
53
- "version": "2.1.3",
64
+ "some-other-tool": {
65
+ "version": "2.0.0",
54
66
  "commands": [
55
- "dotnetsay"
67
+ "some-other-tool"
56
68
  ]
57
69
  }
58
70
  }
59
71
  }
60
72
  """)
61
- ]);
73
+ ]
74
+ );
62
75
  }
63
76
 
64
77
  [Fact]
65
78
  public async Task NoChangeWhenDotNetToolsJsonInUnexpectedLocation()
66
79
  {
67
- await TestNoChangeforProject("Microsoft.BotSay", "1.0.0", "1.1.0",
80
+ await TestNoChangeforProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
81
+ packages:
82
+ [
83
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
84
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
85
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
86
+ MockNuGetPackage.CreateDotNetToolPackage("Some-Other-Tool", "2.0.0", "net8.0"),
87
+ ],
68
88
  // initial
69
89
  projectFilePath: "src/project/project.csproj",
70
90
  projectContents: """
71
- <Project Sdk="Microsoft.NET.Sdk">
72
- <PropertyGroup>
73
- <TargetFramework>netstandard2.0</TargetFramework>
74
- </PropertyGroup>
91
+ <Project Sdk="Microsoft.NET.Sdk">
92
+ <PropertyGroup>
93
+ <TargetFramework>net8.0</TargetFramework>
94
+ </PropertyGroup>
75
95
 
76
- <ItemGroup>
77
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
78
- </ItemGroup>
79
- </Project>
80
- """,
96
+ <ItemGroup>
97
+ <PackageReference Include="Some.Package" Version="13.0.3" />
98
+ </ItemGroup>
99
+ </Project>
100
+ """,
81
101
  additionalFiles:
82
102
  [
83
103
  ("eng/.config/dotnet-tools.json", """
@@ -85,34 +105,41 @@ public partial class UpdateWorkerTests
85
105
  "version": 1,
86
106
  "isRoot": true,
87
107
  "tools": {
88
- "dotnetsay": {
89
- "version": "2.1.3",
108
+ "some-other-tool": {
109
+ "version": "2.0.0",
90
110
  "commands": [
91
- "dotnetsay"
111
+ "some-other-tool"
92
112
  ]
93
113
  }
94
114
  }
95
115
  }
96
116
  """)
97
- ]);
117
+ ]
118
+ );
98
119
  }
99
120
 
100
121
  [Fact]
101
- public async Task UpdateSingleDependencyInDirsProj()
122
+ public async Task UpdateSingleDependency()
102
123
  {
103
- await TestUpdateForProject("Microsoft.BotSay", "1.0.0", "1.1.0",
124
+ await TestUpdateForProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
125
+ packages:
126
+ [
127
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
128
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
129
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
130
+ ],
104
131
  // initial
105
132
  projectContents: """
106
- <Project Sdk="Microsoft.NET.Sdk">
107
- <PropertyGroup>
108
- <TargetFramework>netstandard2.0</TargetFramework>
109
- </PropertyGroup>
133
+ <Project Sdk="Microsoft.NET.Sdk">
134
+ <PropertyGroup>
135
+ <TargetFramework>net8.0</TargetFramework>
136
+ </PropertyGroup>
110
137
 
111
- <ItemGroup>
112
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
113
- </ItemGroup>
114
- </Project>
115
- """,
138
+ <ItemGroup>
139
+ <PackageReference Include="Some.Package" Version="13.0.3" />
140
+ </ItemGroup>
141
+ </Project>
142
+ """,
116
143
  additionalFiles:
117
144
  [
118
145
  (".config/dotnet-tools.json", """
@@ -120,16 +147,16 @@ public partial class UpdateWorkerTests
120
147
  "version": 1,
121
148
  "isRoot": true,
122
149
  "tools": {
123
- "microsoft.botsay": {
150
+ "some.dotnet.tool": {
124
151
  "version": "1.0.0",
125
152
  "commands": [
126
- "botsay"
153
+ "some.dotnet.tool"
127
154
  ]
128
155
  },
129
- "dotnetsay": {
156
+ "some-other-tool": {
130
157
  "version": "2.1.3",
131
158
  "commands": [
132
- "dotnetsay"
159
+ "some-other-tool"
133
160
  ]
134
161
  }
135
162
  }
@@ -138,16 +165,16 @@ public partial class UpdateWorkerTests
138
165
  ],
139
166
  // expected
140
167
  expectedProjectContents: """
141
- <Project Sdk="Microsoft.NET.Sdk">
142
- <PropertyGroup>
143
- <TargetFramework>netstandard2.0</TargetFramework>
144
- </PropertyGroup>
168
+ <Project Sdk="Microsoft.NET.Sdk">
169
+ <PropertyGroup>
170
+ <TargetFramework>net8.0</TargetFramework>
171
+ </PropertyGroup>
145
172
 
146
- <ItemGroup>
147
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
148
- </ItemGroup>
149
- </Project>
150
- """,
173
+ <ItemGroup>
174
+ <PackageReference Include="Some.Package" Version="13.0.3" />
175
+ </ItemGroup>
176
+ </Project>
177
+ """,
151
178
  additionalFilesExpected:
152
179
  [
153
180
  (".config/dotnet-tools.json", """
@@ -155,40 +182,47 @@ public partial class UpdateWorkerTests
155
182
  "version": 1,
156
183
  "isRoot": true,
157
184
  "tools": {
158
- "microsoft.botsay": {
185
+ "some.dotnet.tool": {
159
186
  "version": "1.1.0",
160
187
  "commands": [
161
- "botsay"
188
+ "some.dotnet.tool"
162
189
  ]
163
190
  },
164
- "dotnetsay": {
191
+ "some-other-tool": {
165
192
  "version": "2.1.3",
166
193
  "commands": [
167
- "dotnetsay"
194
+ "some-other-tool"
168
195
  ]
169
196
  }
170
197
  }
171
198
  }
172
199
  """)
173
- ]);
200
+ ]
201
+ );
174
202
  }
175
203
 
176
204
  [Fact]
177
205
  public async Task UpdateSingleDependencyWithComments()
178
206
  {
179
- await TestUpdateForProject("Microsoft.BotSay", "1.0.0", "1.1.0",
207
+ await TestUpdateForProject("Some.DotNet.Tool", "1.0.0", "1.1.0",
208
+ packages:
209
+ [
210
+ MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.3", "net8.0"),
211
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.0.0", "net8.0"),
212
+ MockNuGetPackage.CreateDotNetToolPackage("Some.DotNet.Tool", "1.1.0", "net8.0"),
213
+ ],
180
214
  // initial
181
215
  projectContents: """
182
- <Project Sdk="Microsoft.NET.Sdk">
183
- <PropertyGroup>
184
- <TargetFramework>netstandard2.0</TargetFramework>
185
- </PropertyGroup>
216
+ <Project Sdk="Microsoft.NET.Sdk">
217
+ <PropertyGroup>
218
+ <TargetFramework>net8.0</TargetFramework>
219
+ </PropertyGroup>
186
220
 
187
- <ItemGroup>
188
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
189
- </ItemGroup>
190
- </Project>
191
- """,
221
+ <ItemGroup>
222
+ <PackageReference Include="Some.Package" Version="13.0.3" />
223
+ </ItemGroup>
224
+ </Project>
225
+ """,
192
226
  additionalFiles:
193
227
  [
194
228
  (".config/dotnet-tools.json", """
@@ -197,17 +231,17 @@ public partial class UpdateWorkerTests
197
231
  "version": 1,
198
232
  "isRoot": true,
199
233
  "tools": {
200
- "microsoft.botsay": {
234
+ "some.dotnet.tool": {
201
235
  // this is a deep comment
202
236
  "version": "1.0.0",
203
237
  "commands": [
204
- "botsay"
238
+ "some.dotnet.tool"
205
239
  ]
206
240
  },
207
- "dotnetsay": {
241
+ "some-other-tool": {
208
242
  "version": "2.1.3",
209
243
  "commands": [
210
- "dotnetsay"
244
+ "some-other-tool"
211
245
  ]
212
246
  }
213
247
  }
@@ -216,16 +250,16 @@ public partial class UpdateWorkerTests
216
250
  ],
217
251
  // expected
218
252
  expectedProjectContents: """
219
- <Project Sdk="Microsoft.NET.Sdk">
220
- <PropertyGroup>
221
- <TargetFramework>netstandard2.0</TargetFramework>
222
- </PropertyGroup>
253
+ <Project Sdk="Microsoft.NET.Sdk">
254
+ <PropertyGroup>
255
+ <TargetFramework>net8.0</TargetFramework>
256
+ </PropertyGroup>
223
257
 
224
- <ItemGroup>
225
- <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
226
- </ItemGroup>
227
- </Project>
228
- """,
258
+ <ItemGroup>
259
+ <PackageReference Include="Some.Package" Version="13.0.3" />
260
+ </ItemGroup>
261
+ </Project>
262
+ """,
229
263
  additionalFilesExpected:
230
264
  [
231
265
  (".config/dotnet-tools.json", """
@@ -234,23 +268,24 @@ public partial class UpdateWorkerTests
234
268
  "version": 1,
235
269
  "isRoot": true,
236
270
  "tools": {
237
- "microsoft.botsay": {
271
+ "some.dotnet.tool": {
238
272
  // this is a deep comment
239
273
  "version": "1.1.0",
240
274
  "commands": [
241
- "botsay"
275
+ "some.dotnet.tool"
242
276
  ]
243
277
  },
244
- "dotnetsay": {
278
+ "some-other-tool": {
245
279
  "version": "2.1.3",
246
280
  "commands": [
247
- "dotnetsay"
281
+ "some-other-tool"
248
282
  ]
249
283
  }
250
284
  }
251
285
  }
252
286
  """)
253
- ]);
287
+ ]
288
+ );
254
289
  }
255
290
  }
256
291
  }