File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
test/Microsoft.NET.Build.Tests Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System . Text . RegularExpressions ;
5
+ using NuGet . Common ;
6
+ using NuGet . Frameworks ;
7
+ using NuGet . ProjectModel ;
5
8
6
9
namespace Microsoft . NET . Build . Tests
7
10
{
@@ -286,15 +289,16 @@ public void PlatformPackagesCanBePruned(bool prunePackages)
286
289
buildCommand . Execute ( ) . Should ( ) . Pass ( ) ;
287
290
288
291
var assetsFilePath = Path . Combine ( buildCommand . GetBaseIntermediateDirectory ( ) . FullName , "project.assets.json" ) ;
289
-
290
- // TODO: parse and process assets file instead of just loooking for string in it
292
+ var lockFile = LockFileUtilities . GetLockFile ( assetsFilePath , new NullLogger ( ) ) ;
293
+ var lockFileTarget = lockFile . GetTarget ( NuGetFramework . Parse ( ToolsetInfo . CurrentTargetFramework ) , runtimeIdentifier : null ) ;
294
+
291
295
if ( prunePackages )
292
296
{
293
- File . ReadAllText ( assetsFilePath ) . Should ( ) . NotContain ( "System.Text.Json" ) ;
297
+ lockFileTarget . Libraries . Should ( ) . NotContain ( library => library . Name . Equals ( "System.Text.Json" , StringComparison . OrdinalIgnoreCase ) ) ;
294
298
}
295
299
else
296
300
{
297
- File . ReadAllText ( assetsFilePath ) . Should ( ) . Contain ( "System.Text.Json" ) ;
301
+ lockFileTarget . Libraries . Should ( ) . Contain ( library => library . Name . Equals ( "System.Text.Json" , StringComparison . OrdinalIgnoreCase ) ) ;
298
302
}
299
303
}
300
304
}
You can’t perform that action at this time.
0 commit comments