@@ -35,6 +35,14 @@ public async Task RunTests_With_VSTest(string multiTfm, BuildConfiguration build
35
35
. PatchCodeWithReplace ( "$Extensions$" , string . Empty ) ,
36
36
addPublicFeeds : true ) ;
37
37
38
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
39
+ <Project>
40
+ <PropertyGroup>
41
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
42
+ </PropertyGroup>
43
+ </Project>
44
+ """ ) ;
45
+
38
46
var compilationResult = await DotnetCli . RunAsync ( $ "test -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
39
47
Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
40
48
@@ -63,6 +71,14 @@ public async Task RunTests_With_MSTestRunner_DotnetTest(string multiTfm, BuildCo
63
71
. PatchCodeWithReplace ( "$Extensions$" , string . Empty ) ,
64
72
addPublicFeeds : true ) ;
65
73
74
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
75
+ <Project>
76
+ <PropertyGroup>
77
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
78
+ </PropertyGroup>
79
+ </Project>
80
+ """ ) ;
81
+
66
82
var compilationResult = await DotnetCli . RunAsync ( $ "test -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
67
83
Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
68
84
@@ -91,6 +107,47 @@ public async Task RunTests_With_MSTestRunner_Standalone(string multiTfm, BuildCo
91
107
. PatchCodeWithReplace ( "$Extensions$" , string . Empty ) ,
92
108
addPublicFeeds : true ) ;
93
109
110
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
111
+ <Project>
112
+ <PropertyGroup>
113
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
114
+ </PropertyGroup>
115
+ </Project>
116
+ """ ) ;
117
+
118
+ var compilationResult = await DotnetCli . RunAsync ( $ "build -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
119
+ Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
120
+ foreach ( var tfm in multiTfm . Split ( ";" ) )
121
+ {
122
+ var testHost = TestHost . LocateFrom ( generator . TargetAssetPath , AssetName , tfm , buildConfiguration : buildConfiguration ) ;
123
+ var testHostResult = await testHost . ExecuteAsync ( ) ;
124
+ testHostResult . AssertOutputContains ( "Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1" ) ;
125
+ }
126
+ }
127
+
128
+ [ ArgumentsProvider ( nameof ( GetBuildMatrixMultiTfmFoldedBuildConfiguration ) ) ]
129
+ public async Task RunTests_With_CentralPackageManagement_Standalone ( string multiTfm , BuildConfiguration buildConfiguration )
130
+ {
131
+ using TestAsset generator = await TestAsset . GenerateAssetAsync (
132
+ AssetName ,
133
+ SourceCode
134
+ . PatchCodeWithReplace ( "$MSTestVersion$" , MSTestVersion )
135
+ . PatchCodeWithReplace ( "$OutputType$" , string . Empty )
136
+ . PatchCodeWithReplace ( "$TargetFramework$" , $ "<TargetFrameworks>{ multiTfm } </TargetFrameworks>")
137
+ . PatchCodeWithReplace ( "$EnableMSTestRunner$" , string . Empty )
138
+ . PatchCodeWithReplace ( "$TestingPlatformDotnetTestSupport$" , string . Empty )
139
+ . PatchCodeWithReplace ( "$ExtraProperties$" , string . Empty )
140
+ . PatchCodeWithReplace ( "$Extensions$" , string . Empty ) ,
141
+ addPublicFeeds : true ) ;
142
+
143
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
144
+ <Project>
145
+ <PropertyGroup>
146
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
147
+ </PropertyGroup>
148
+ </Project>
149
+ """ ) ;
150
+
94
151
var compilationResult = await DotnetCli . RunAsync ( $ "build -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
95
152
Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
96
153
foreach ( var tfm in multiTfm . Split ( ";" ) )
@@ -160,6 +217,14 @@ public async Task RunTests_With_MSTestRunner_Standalone_Selectively_Enabled_Exte
160
217
. PatchCodeWithReplace ( "$Extensions$" , msbuildExtensionEnableFragment ) ,
161
218
addPublicFeeds : true ) ;
162
219
220
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
221
+ <Project>
222
+ <PropertyGroup>
223
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
224
+ </PropertyGroup>
225
+ </Project>
226
+ """ ) ;
227
+
163
228
var compilationResult = await DotnetCli . RunAsync ( $ "build -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
164
229
Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
165
230
foreach ( var tfm in multiTfm . Split ( ";" ) )
@@ -188,6 +253,14 @@ public async Task RunTests_With_MSTestRunner_Standalone_EnableAll_Extensions(str
188
253
. PatchCodeWithReplace ( "$Extensions$" , "<TestingExtensionsProfile>AllMicrosoft</TestingExtensionsProfile>" ) ,
189
254
addPublicFeeds : true ) ;
190
255
256
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
257
+ <Project>
258
+ <PropertyGroup>
259
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
260
+ </PropertyGroup>
261
+ </Project>
262
+ """ ) ;
263
+
191
264
var compilationResult = await DotnetCli . RunAsync ( $ "build -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
192
265
Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
193
266
foreach ( var tfm in multiTfm . Split ( ";" ) )
@@ -227,6 +300,14 @@ public async Task RunTests_With_MSTestRunner_Standalone_Enable_Default_Extension
227
300
. PatchCodeWithReplace ( "$Extensions$" , enableDefaultExtensions ? string . Empty : "<TestingExtensionsProfile>None</TestingExtensionsProfile>" ) ,
228
301
addPublicFeeds : true ) ;
229
302
303
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
304
+ <Project>
305
+ <PropertyGroup>
306
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
307
+ </PropertyGroup>
308
+ </Project>
309
+ """ ) ;
310
+
230
311
var compilationResult = await DotnetCli . RunAsync ( $ "build -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
231
312
Assert . AreEqual ( 0 , compilationResult . ExitCode ) ;
232
313
foreach ( var tfm in multiTfm . Split ( ";" ) )
@@ -259,6 +340,14 @@ public async Task Invalid_TestingProfile_Name_Should_Fail(string multiTfm, Build
259
340
. PatchCodeWithReplace ( "$Extensions$" , "<TestingExtensionsProfile>WrongName</TestingExtensionsProfile>" ) ,
260
341
addPublicFeeds : true ) ;
261
342
343
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
344
+ <Project>
345
+ <PropertyGroup>
346
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
347
+ </PropertyGroup>
348
+ </Project>
349
+ """ ) ;
350
+
262
351
var compilationResult = await DotnetCli . RunAsync ( $ "build -c { buildConfiguration } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path , failIfReturnValueIsNotZero : false ) ;
263
352
Assert . AreEqual ( 1 , compilationResult . ExitCode ) ;
264
353
compilationResult . AssertOutputContains ( "Invalid value for property TestingExtensionsProfile. Valid values are 'Default', 'AllMicrosoft' and 'None'." ) ;
@@ -291,6 +380,14 @@ await RetryHelper.RetryAsync(
291
380
. PatchCodeWithReplace ( "$Extensions$" , string . Empty ) ,
292
381
addPublicFeeds : true ) ;
293
382
383
+ File . WriteAllText ( Path . Combine ( generator . TargetAssetPath , "Directory.Packages.props" ) , """
384
+ <Project>
385
+ <PropertyGroup>
386
+ <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
387
+ </PropertyGroup>
388
+ </Project>
389
+ """ ) ;
390
+
294
391
var compilationResult = await DotnetCli . RunAsync ( $ "publish -r { RID } { generator . TargetAssetPath } ", _acceptanceFixture . NuGetGlobalPackagesFolder . Path ) ;
295
392
compilationResult . AssertOutputNotContains ( "warning" ) ;
296
393
compilationResult . AssertOutputContains ( "Generating native code" ) ;
@@ -311,6 +408,7 @@ await RetryHelper.RetryAsync(
311
408
$TestingPlatformDotnetTestSupport$
312
409
$ExtraProperties$
313
410
<PlatformTarget>x64</PlatformTarget>
411
+ <NoWarn>$(NoWarn);NU1507</NoWarn>
314
412
</PropertyGroup>
315
413
316
414
<!-- Extensions -->
0 commit comments