dependabot-nuget 0.321.3 → 0.322.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +22 -22
- data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Cli/Program.cs +21 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +19 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/CloneCommand.cs +19 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +21 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs +8 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +29 -16
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +20 -19
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +10 -23
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +15 -232
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +1 -154
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Files/GlobalJsonBuildFile.cs +5 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/PrivateSourceTimedOutException.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +4 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PrivateSourceTimedOut.cs +10 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/AzurePackageDetailFinder.cs +30 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/DetailedPullRequestBodyGenerator.cs +237 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/GitHubPackageDetailFinder.cs +101 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/GitLabPackageDetailFinder.cs +107 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/HttpFetcher.cs +32 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IHttpFetcher.cs +30 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IPackageDetailFinder.cs +47 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/IPullRequestBodyGenerator.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestBodyGenerator/SimplePullRequestBodyGenerator.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestTextGenerator.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +3 -525
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/GroupUpdateAllVersionsHandler.cs +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandler.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +85 -35
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/XmlFileWriter.cs +27 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +1 -856
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +18 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +16 -200
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +21 -556
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +9 -73
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Clone/CloneWorkerTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolver/MSBuildDependencySolverTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -20
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +3 -62
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +13 -563
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +20 -269
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Files/GlobalJsonBuildFileTests.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +131 -131
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/HttpApiHandlerTests.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/JobErrorBaseTests.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MessageReportTests.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +0 -203
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/DetailedPullRequestBodyGeneratorTests.cs +871 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/IPackageDetailFinderTests.cs +28 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestBodyGenerator/TestHttpFetcher.cs +23 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestTextTests.cs +24 -24
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +14 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/CreateSecurityUpdatePullRequestHandlerTests.cs +6 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/GroupUpdateAllVersionsHandlerTests.cs +18 -18
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshGroupUpdatePullRequestHandlerTests.cs +15 -15
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshSecurityUpdatePullRequestHandlerTests.cs +21 -21
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/RefreshVersionUpdatePullRequestHandlerTests.cs +15 -15
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdateHandlers/UpdateHandlersTestsBase.cs +1 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests_MiscellaneousTests.cs +45 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests.cs +111 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackageReferenceUpdaterTests.cs +1 -159
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +26 -660
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- metadata +18 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs +0 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestMessageTests.cs +0 -296
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +0 -3592
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatePermittedAndMessageTests.cs +0 -457
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +0 -378
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs +0 -175
@@ -1,378 +0,0 @@
|
|
1
|
-
using Xunit;
|
2
|
-
|
3
|
-
namespace NuGetUpdater.Core.Test.Update;
|
4
|
-
|
5
|
-
public partial class UpdateWorkerTests
|
6
|
-
{
|
7
|
-
public class DirsProj : UpdateWorkerTestBase
|
8
|
-
{
|
9
|
-
[Fact]
|
10
|
-
public async Task UpdateSingleDependencyInDirsProj()
|
11
|
-
{
|
12
|
-
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
13
|
-
packages:
|
14
|
-
[
|
15
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
16
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
17
|
-
],
|
18
|
-
// initial
|
19
|
-
projectContents: """
|
20
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
21
|
-
|
22
|
-
<ItemGroup>
|
23
|
-
<ProjectReference Include="src/test-project.csproj" />
|
24
|
-
</ItemGroup>
|
25
|
-
|
26
|
-
</Project>
|
27
|
-
""",
|
28
|
-
additionalFiles:
|
29
|
-
[
|
30
|
-
("src/test-project.csproj",
|
31
|
-
"""
|
32
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
33
|
-
<PropertyGroup>
|
34
|
-
<TargetFramework>net8.0</TargetFramework>
|
35
|
-
</PropertyGroup>
|
36
|
-
|
37
|
-
<ItemGroup>
|
38
|
-
<PackageReference Include="Some.Package" Version="9.0.1" />
|
39
|
-
</ItemGroup>
|
40
|
-
</Project>
|
41
|
-
""")
|
42
|
-
],
|
43
|
-
// expected
|
44
|
-
expectedProjectContents: """
|
45
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
46
|
-
|
47
|
-
<ItemGroup>
|
48
|
-
<ProjectReference Include="src/test-project.csproj" />
|
49
|
-
</ItemGroup>
|
50
|
-
|
51
|
-
</Project>
|
52
|
-
""",
|
53
|
-
additionalFilesExpected:
|
54
|
-
[
|
55
|
-
("src/test-project.csproj",
|
56
|
-
"""
|
57
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
58
|
-
<PropertyGroup>
|
59
|
-
<TargetFramework>net8.0</TargetFramework>
|
60
|
-
</PropertyGroup>
|
61
|
-
|
62
|
-
<ItemGroup>
|
63
|
-
<PackageReference Include="Some.Package" Version="13.0.1" />
|
64
|
-
</ItemGroup>
|
65
|
-
</Project>
|
66
|
-
""")
|
67
|
-
]
|
68
|
-
);
|
69
|
-
}
|
70
|
-
|
71
|
-
[Fact]
|
72
|
-
public async Task Update_MissingFileDoesNotThrow()
|
73
|
-
{
|
74
|
-
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
75
|
-
packages:
|
76
|
-
[
|
77
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
78
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
79
|
-
],
|
80
|
-
projectContents: """
|
81
|
-
<Project Sdk="Microsoft.Build.Traversal">
|
82
|
-
<ItemGroup>
|
83
|
-
<ProjectReference Include="private\dirs.proj" />
|
84
|
-
</ItemGroup>
|
85
|
-
</Project>
|
86
|
-
""",
|
87
|
-
expectedProjectContents: """
|
88
|
-
<Project Sdk="Microsoft.Build.Traversal">
|
89
|
-
<ItemGroup>
|
90
|
-
<ProjectReference Include="private\dirs.proj" />
|
91
|
-
</ItemGroup>
|
92
|
-
</Project>
|
93
|
-
""",
|
94
|
-
additionalFiles: []
|
95
|
-
);
|
96
|
-
}
|
97
|
-
|
98
|
-
[Fact]
|
99
|
-
public async Task UpdateSingleDependencyInNestedDirsProj()
|
100
|
-
{
|
101
|
-
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
102
|
-
packages:
|
103
|
-
[
|
104
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
105
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
106
|
-
],
|
107
|
-
// initial
|
108
|
-
projectContents: """
|
109
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
110
|
-
|
111
|
-
<ItemGroup>
|
112
|
-
<ProjectReference Include="src/dirs.proj" />
|
113
|
-
</ItemGroup>
|
114
|
-
|
115
|
-
</Project>
|
116
|
-
""",
|
117
|
-
additionalFiles:
|
118
|
-
[
|
119
|
-
("src/dirs.proj",
|
120
|
-
"""
|
121
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
122
|
-
|
123
|
-
<ItemGroup>
|
124
|
-
<ProjectReference Include="test-project/test-project.csproj" />
|
125
|
-
</ItemGroup>
|
126
|
-
|
127
|
-
</Project>
|
128
|
-
"""),
|
129
|
-
("src/test-project/test-project.csproj",
|
130
|
-
"""
|
131
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
132
|
-
<PropertyGroup>
|
133
|
-
<TargetFramework>net8.0</TargetFramework>
|
134
|
-
</PropertyGroup>
|
135
|
-
|
136
|
-
<ItemGroup>
|
137
|
-
<PackageReference Include="Some.Package" Version="9.0.1" />
|
138
|
-
</ItemGroup>
|
139
|
-
</Project>
|
140
|
-
""")
|
141
|
-
],
|
142
|
-
// expected
|
143
|
-
expectedProjectContents: """
|
144
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
145
|
-
|
146
|
-
<ItemGroup>
|
147
|
-
<ProjectReference Include="src/dirs.proj" />
|
148
|
-
</ItemGroup>
|
149
|
-
|
150
|
-
</Project>
|
151
|
-
""",
|
152
|
-
additionalFilesExpected:
|
153
|
-
[
|
154
|
-
("src/dirs.proj",
|
155
|
-
"""
|
156
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
157
|
-
|
158
|
-
<ItemGroup>
|
159
|
-
<ProjectReference Include="test-project/test-project.csproj" />
|
160
|
-
</ItemGroup>
|
161
|
-
|
162
|
-
</Project>
|
163
|
-
"""),
|
164
|
-
("src/test-project/test-project.csproj",
|
165
|
-
"""
|
166
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
167
|
-
<PropertyGroup>
|
168
|
-
<TargetFramework>net8.0</TargetFramework>
|
169
|
-
</PropertyGroup>
|
170
|
-
|
171
|
-
<ItemGroup>
|
172
|
-
<PackageReference Include="Some.Package" Version="13.0.1" />
|
173
|
-
</ItemGroup>
|
174
|
-
</Project>
|
175
|
-
""")
|
176
|
-
]
|
177
|
-
);
|
178
|
-
}
|
179
|
-
|
180
|
-
[Fact]
|
181
|
-
public async Task UpdateSingleDependencyInNestedDirsProjUsingWildcard()
|
182
|
-
{
|
183
|
-
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
184
|
-
packages:
|
185
|
-
[
|
186
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
187
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
188
|
-
],
|
189
|
-
// initial
|
190
|
-
projectContents: """
|
191
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
192
|
-
|
193
|
-
<ItemGroup>
|
194
|
-
<ProjectReference Include="src/*.proj" />
|
195
|
-
</ItemGroup>
|
196
|
-
|
197
|
-
</Project>
|
198
|
-
""",
|
199
|
-
additionalFiles:
|
200
|
-
[
|
201
|
-
("src/dirs.proj",
|
202
|
-
"""
|
203
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
204
|
-
|
205
|
-
<ItemGroup>
|
206
|
-
<ProjectReference Include="test-project/test-project.csproj" />
|
207
|
-
</ItemGroup>
|
208
|
-
|
209
|
-
</Project>
|
210
|
-
"""),
|
211
|
-
("src/test-project/test-project.csproj",
|
212
|
-
"""
|
213
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
214
|
-
<PropertyGroup>
|
215
|
-
<TargetFramework>net8.0</TargetFramework>
|
216
|
-
</PropertyGroup>
|
217
|
-
|
218
|
-
<ItemGroup>
|
219
|
-
<PackageReference Include="Some.Package" Version="9.0.1" />
|
220
|
-
</ItemGroup>
|
221
|
-
</Project>
|
222
|
-
""")
|
223
|
-
],
|
224
|
-
// expected
|
225
|
-
expectedProjectContents: """
|
226
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
227
|
-
|
228
|
-
<ItemGroup>
|
229
|
-
<ProjectReference Include="src/*.proj" />
|
230
|
-
</ItemGroup>
|
231
|
-
|
232
|
-
</Project>
|
233
|
-
""",
|
234
|
-
additionalFilesExpected:
|
235
|
-
[
|
236
|
-
("src/dirs.proj",
|
237
|
-
"""
|
238
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
239
|
-
|
240
|
-
<ItemGroup>
|
241
|
-
<ProjectReference Include="test-project/test-project.csproj" />
|
242
|
-
</ItemGroup>
|
243
|
-
|
244
|
-
</Project>
|
245
|
-
"""),
|
246
|
-
("src/test-project/test-project.csproj",
|
247
|
-
"""
|
248
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
249
|
-
<PropertyGroup>
|
250
|
-
<TargetFramework>net8.0</TargetFramework>
|
251
|
-
</PropertyGroup>
|
252
|
-
|
253
|
-
<ItemGroup>
|
254
|
-
<PackageReference Include="Some.Package" Version="13.0.1" />
|
255
|
-
</ItemGroup>
|
256
|
-
</Project>
|
257
|
-
""")
|
258
|
-
]
|
259
|
-
);
|
260
|
-
}
|
261
|
-
|
262
|
-
[Fact]
|
263
|
-
public async Task UpdateSingleDependencyInNestedDirsProjUsingRecursiveWildcard()
|
264
|
-
{
|
265
|
-
await TestUpdateForDirsProj("Some.Package", "9.0.1", "13.0.1",
|
266
|
-
packages:
|
267
|
-
[
|
268
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
269
|
-
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
270
|
-
],
|
271
|
-
// initial
|
272
|
-
projectContents: """
|
273
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
274
|
-
|
275
|
-
<ItemGroup>
|
276
|
-
<ProjectReference Include="**/*.proj" />
|
277
|
-
</ItemGroup>
|
278
|
-
|
279
|
-
</Project>
|
280
|
-
""",
|
281
|
-
additionalFiles:
|
282
|
-
[
|
283
|
-
("src/dirs.proj",
|
284
|
-
"""
|
285
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
286
|
-
|
287
|
-
<ItemGroup>
|
288
|
-
<ProjectReference Include="test-project/test-project.csproj" />
|
289
|
-
</ItemGroup>
|
290
|
-
|
291
|
-
</Project>
|
292
|
-
"""),
|
293
|
-
("src/test-project/test-project.csproj",
|
294
|
-
"""
|
295
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
296
|
-
<PropertyGroup>
|
297
|
-
<TargetFramework>net8.0</TargetFramework>
|
298
|
-
</PropertyGroup>
|
299
|
-
|
300
|
-
<ItemGroup>
|
301
|
-
<PackageReference Include="Some.Package" Version="9.0.1" />
|
302
|
-
</ItemGroup>
|
303
|
-
</Project>
|
304
|
-
""")
|
305
|
-
],
|
306
|
-
// expected
|
307
|
-
expectedProjectContents: """
|
308
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
309
|
-
|
310
|
-
<ItemGroup>
|
311
|
-
<ProjectReference Include="**/*.proj" />
|
312
|
-
</ItemGroup>
|
313
|
-
|
314
|
-
</Project>
|
315
|
-
""",
|
316
|
-
additionalFilesExpected:
|
317
|
-
[
|
318
|
-
("src/dirs.proj",
|
319
|
-
"""
|
320
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
321
|
-
|
322
|
-
<ItemGroup>
|
323
|
-
<ProjectReference Include="test-project/test-project.csproj" />
|
324
|
-
</ItemGroup>
|
325
|
-
|
326
|
-
</Project>
|
327
|
-
"""),
|
328
|
-
("src/test-project/test-project.csproj",
|
329
|
-
"""
|
330
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
331
|
-
<PropertyGroup>
|
332
|
-
<TargetFramework>net8.0</TargetFramework>
|
333
|
-
</PropertyGroup>
|
334
|
-
|
335
|
-
<ItemGroup>
|
336
|
-
<PackageReference Include="Some.Package" Version="13.0.1" />
|
337
|
-
</ItemGroup>
|
338
|
-
</Project>
|
339
|
-
""")
|
340
|
-
]
|
341
|
-
);
|
342
|
-
}
|
343
|
-
|
344
|
-
static async Task TestUpdateForDirsProj(
|
345
|
-
string dependencyName,
|
346
|
-
string oldVersion,
|
347
|
-
string newVersion,
|
348
|
-
string projectContents,
|
349
|
-
string expectedProjectContents,
|
350
|
-
bool isTransitive = false,
|
351
|
-
(string Path, string Content)[]? additionalFiles = null,
|
352
|
-
(string Path, string Content)[]? additionalFilesExpected = null,
|
353
|
-
MockNuGetPackage[]? packages = null,
|
354
|
-
ExperimentsManager? experimentsManager = null)
|
355
|
-
{
|
356
|
-
additionalFiles ??= [];
|
357
|
-
additionalFilesExpected ??= [];
|
358
|
-
|
359
|
-
var projectName = "dirs";
|
360
|
-
var projectFileName = $"{projectName}.proj";
|
361
|
-
var testFiles = additionalFiles.Prepend((projectFileName, projectContents)).ToArray();
|
362
|
-
|
363
|
-
var actualResult = await RunUpdate(testFiles, async (temporaryDirectory) =>
|
364
|
-
{
|
365
|
-
await MockNuGetPackagesInDirectory(packages, temporaryDirectory);
|
366
|
-
|
367
|
-
experimentsManager ??= new ExperimentsManager();
|
368
|
-
var projectPath = Path.Combine(temporaryDirectory, projectFileName);
|
369
|
-
var worker = new UpdaterWorker("TEST-JOB-ID", experimentsManager, new TestLogger());
|
370
|
-
await worker.RunAsync(temporaryDirectory, projectPath, dependencyName, oldVersion, newVersion, isTransitive);
|
371
|
-
});
|
372
|
-
|
373
|
-
var expectedResult = additionalFilesExpected.Prepend((projectFileName, expectedProjectContents)).ToArray();
|
374
|
-
|
375
|
-
AssertContainsFiles(expectedResult, actualResult);
|
376
|
-
}
|
377
|
-
}
|
378
|
-
}
|
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs
DELETED
@@ -1,175 +0,0 @@
|
|
1
|
-
using Xunit;
|
2
|
-
|
3
|
-
namespace NuGetUpdater.Core.Test.Utilities
|
4
|
-
{
|
5
|
-
public class SdkPackageUpdaterHelperTests : TestBase
|
6
|
-
{
|
7
|
-
[Fact]
|
8
|
-
public async Task DirectoryBuildFilesAreOnlyPulledInFromParentDirectories()
|
9
|
-
{
|
10
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
11
|
-
("src/SomeProject.csproj", """
|
12
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
13
|
-
<Import Project="..\props\Versions.props" />
|
14
|
-
</Project>
|
15
|
-
"""),
|
16
|
-
("src/Directory.Build.targets", """
|
17
|
-
<Project>
|
18
|
-
</Project>
|
19
|
-
"""),
|
20
|
-
("props/Versions.props", """
|
21
|
-
<Project>
|
22
|
-
</Project>
|
23
|
-
"""),
|
24
|
-
("Directory.Build.props", """
|
25
|
-
<Project>
|
26
|
-
</Project>
|
27
|
-
"""),
|
28
|
-
("test/Directory.Build.props", """
|
29
|
-
<Project>
|
30
|
-
<!-- this file should not be loaded -->
|
31
|
-
</Project>
|
32
|
-
""")
|
33
|
-
);
|
34
|
-
var actualBuildFilePaths = await LoadBuildFilesFromTemp(temporaryDirectory, "src/SomeProject.csproj");
|
35
|
-
var expectedBuildFilePaths = new[]
|
36
|
-
{
|
37
|
-
"src/SomeProject.csproj",
|
38
|
-
"Directory.Build.props",
|
39
|
-
"props/Versions.props",
|
40
|
-
"src/Directory.Build.targets",
|
41
|
-
};
|
42
|
-
Assert.Equal(expectedBuildFilePaths, actualBuildFilePaths);
|
43
|
-
}
|
44
|
-
|
45
|
-
[Theory]
|
46
|
-
[InlineData("", "")] // everything at root
|
47
|
-
[InlineData("src/", "src/")] // everything in subdirectory
|
48
|
-
[InlineData("src/", "")] // project in subdirectory, global.json at root
|
49
|
-
public async Task BuildFileEnumerationWorksEvenWithNonSupportedSdkInGlobalJson(string projectSubpath, string globalJsonSubpath)
|
50
|
-
{
|
51
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
52
|
-
($"{projectSubpath}SomeProject.csproj", """
|
53
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
54
|
-
</Project>
|
55
|
-
"""),
|
56
|
-
($"{projectSubpath}Directory.Build.props", """
|
57
|
-
<Project>
|
58
|
-
</Project>
|
59
|
-
"""),
|
60
|
-
($"{globalJsonSubpath}global.json", """
|
61
|
-
{
|
62
|
-
"sdk": {
|
63
|
-
"version": "99.99.99"
|
64
|
-
}
|
65
|
-
}
|
66
|
-
""")
|
67
|
-
);
|
68
|
-
var actualBuildFilePaths = await LoadBuildFilesFromTemp(temporaryDirectory, $"{projectSubpath}/SomeProject.csproj");
|
69
|
-
var expectedBuildFilePaths = new[]
|
70
|
-
{
|
71
|
-
$"{projectSubpath}SomeProject.csproj",
|
72
|
-
$"{projectSubpath}Directory.Build.props",
|
73
|
-
};
|
74
|
-
Assert.Equal(expectedBuildFilePaths, actualBuildFilePaths);
|
75
|
-
Assert.True(File.Exists($"{temporaryDirectory.DirectoryPath}/{globalJsonSubpath}global.json"), "global.json was not restored");
|
76
|
-
}
|
77
|
-
|
78
|
-
[Fact]
|
79
|
-
public async Task BuildFileEnumerationWithNonStandardMSBuildSdkAndNonSupportedSdkVersionInGlobalJson()
|
80
|
-
{
|
81
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
82
|
-
("global.json", """
|
83
|
-
{
|
84
|
-
"sdk": {
|
85
|
-
"version": "99.99.99"
|
86
|
-
},
|
87
|
-
"msbuild-sdks": {
|
88
|
-
"Microsoft.Build.NoTargets": "3.7.0"
|
89
|
-
}
|
90
|
-
}
|
91
|
-
"""),
|
92
|
-
("SomeProject.csproj", """
|
93
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
94
|
-
<Import Project="NoTargets.props" />
|
95
|
-
</Project>
|
96
|
-
"""),
|
97
|
-
("NoTargets.props", """
|
98
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
99
|
-
<Import Project="Versions.props" />
|
100
|
-
</Project>
|
101
|
-
"""),
|
102
|
-
("Versions.props", """
|
103
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
104
|
-
</Project>
|
105
|
-
""")
|
106
|
-
);
|
107
|
-
var actualBuildFilePaths = await LoadBuildFilesFromTemp(temporaryDirectory, "SomeProject.csproj");
|
108
|
-
var expectedBuildFilePaths = new[]
|
109
|
-
{
|
110
|
-
"SomeProject.csproj",
|
111
|
-
"NoTargets.props",
|
112
|
-
"Versions.props",
|
113
|
-
};
|
114
|
-
Assert.Equal(expectedBuildFilePaths, actualBuildFilePaths);
|
115
|
-
var globalJsonContent = await File.ReadAllTextAsync($"{temporaryDirectory.DirectoryPath}/global.json");
|
116
|
-
Assert.Contains("99.99.99", globalJsonContent); // ensure global.json was restored
|
117
|
-
}
|
118
|
-
|
119
|
-
[Fact]
|
120
|
-
public async Task BuildFileEnumerationWithUnsuccessfulImport()
|
121
|
-
{
|
122
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
123
|
-
("Directory.Build.props", """
|
124
|
-
<Project>
|
125
|
-
<Import Project="file-that-does-not-exist.targets" />
|
126
|
-
</Project>
|
127
|
-
"""),
|
128
|
-
("NonBuildingProject.csproj", """
|
129
|
-
<Project Sdk="Microsoft.NET.Sdk">
|
130
|
-
</Project>
|
131
|
-
""")
|
132
|
-
);
|
133
|
-
var actualBuildFilePaths = await LoadBuildFilesFromTemp(temporaryDirectory, "NonBuildingProject.csproj");
|
134
|
-
var expectedBuildFilePaths = new[]
|
135
|
-
{
|
136
|
-
"NonBuildingProject.csproj",
|
137
|
-
"Directory.Build.props",
|
138
|
-
};
|
139
|
-
Assert.Equal(expectedBuildFilePaths, actualBuildFilePaths);
|
140
|
-
}
|
141
|
-
|
142
|
-
[Fact]
|
143
|
-
public async Task BuildFileEnumerationWithGlobalJsonWithComments()
|
144
|
-
{
|
145
|
-
using var temporaryDirectory = await TemporaryDirectory.CreateWithContentsAsync(
|
146
|
-
("global.json", """
|
147
|
-
{
|
148
|
-
// this is a comment
|
149
|
-
"msbuild-sdks": {
|
150
|
-
// this is a deep comment
|
151
|
-
"Microsoft.Build.NoTargets": "3.7.0"
|
152
|
-
}
|
153
|
-
}
|
154
|
-
"""),
|
155
|
-
("NonBuildingProject.csproj", """
|
156
|
-
<Project Sdk="Microsoft.Build.NoTargets">
|
157
|
-
</Project>
|
158
|
-
""")
|
159
|
-
);
|
160
|
-
var actualBuildFilePaths = await LoadBuildFilesFromTemp(temporaryDirectory, "NonBuildingProject.csproj");
|
161
|
-
var expectedBuildFilePaths = new[]
|
162
|
-
{
|
163
|
-
"NonBuildingProject.csproj",
|
164
|
-
};
|
165
|
-
Assert.Equal(expectedBuildFilePaths, actualBuildFilePaths);
|
166
|
-
}
|
167
|
-
|
168
|
-
private static async Task<string[]> LoadBuildFilesFromTemp(TemporaryDirectory temporaryDirectory, string relativeProjectPath)
|
169
|
-
{
|
170
|
-
var (buildFiles, _tfms) = await MSBuildHelper.LoadBuildFilesAndTargetFrameworksAsync(temporaryDirectory.DirectoryPath, $"{temporaryDirectory.DirectoryPath}/{relativeProjectPath}");
|
171
|
-
var buildFilePaths = buildFiles.Select(f => f.RelativePath.NormalizePathToUnix()).ToArray();
|
172
|
-
return buildFilePaths;
|
173
|
-
}
|
174
|
-
}
|
175
|
-
}
|