File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
test/dotnet.Tests/CommandTests/Restore Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33
44using Microsoft . DotNet . Tools . Test . Utilities ;
5+ using Newtonsoft . Json . Linq ;
56using System . Runtime . InteropServices ;
67
78namespace Microsoft . DotNet . Restore . Test
@@ -205,6 +206,22 @@ public void ItRestoresWithRidSpecificOptions(params string[] ridOptions)
205206 // Verify that assets file was created
206207 var assetsFilePath = Path . Combine ( rootPath , "obj" , "project.assets.json" ) ;
207208 File . Exists ( assetsFilePath ) . Should ( ) . BeTrue ( ) ;
209+
210+ // Verify that the assets file contains RID-specific targets when using RID options
211+ if ( ridOptions . Contains ( "-r" ) || ridOptions . Contains ( "--runtime" ) ||
212+ ridOptions . Contains ( "--os" ) || ridOptions . Contains ( "-a" ) || ridOptions . Contains ( "--arch" ) )
213+ {
214+ var assetsContents = JObject . Parse ( File . ReadAllText ( assetsFilePath ) ) ;
215+ var targets = assetsContents [ "targets" ] ;
216+ targets . Should ( ) . NotBeNull ( "assets file should contain targets section" ) ;
217+
218+ // Check for RID-specific targets (targets with RID have names containing "/")
219+ var ridSpecificTargets = targets . Children < JProperty > ( )
220+ . Where ( target => target . Name . Contains ( "/" ) )
221+ . ToList ( ) ;
222+
223+ ridSpecificTargets . Should ( ) . NotBeEmpty ( "assets file should contain RID-specific targets when using RID options" ) ;
224+ }
208225 }
209226
210227 private static string [ ] HandleStaticGraphEvaluation ( bool useStaticGraphEvaluation , string [ ] args ) =>
You can’t perform that action at this time.
0 commit comments