44using System ;
55using System . Collections . Generic ;
66using System . IO ;
7+ using System . Linq ;
78using Xunit ;
89using Xunit . Abstractions ;
910
@@ -42,7 +43,7 @@ public void ConsumerResolvesPluginTypeWhenAssetAssemblyDeclared()
4243 // Namespacing is on by default: both the plugin's and the consumer's own assets compile
4344 // under their rooted URLs.
4445 var dbDir = Path . Combine ( consumerDir , "obj" , "stride" , "assetbuild" , "data" , "db" ) ;
45- var index = File . ReadAllText ( Directory . GetFiles ( dbDir , "index.Consumer.*" ) [ 0 ] ) ;
46+ var index = File . ReadAllText ( IndexFile ( dbDir ) ) ;
4647 Assert . Matches ( @"(?m)^/StrideAssetPlugin/PluginPage " , index ) ;
4748 Assert . Matches ( @"(?m)^/Consumer/Page " , index ) ;
4849
@@ -55,6 +56,10 @@ public void ConsumerResolvesPluginTypeWhenAssetAssemblyDeclared()
5556 AssertRuntimeContentResolves ( consumerDir ) ;
5657 }
5758
59+ /// <summary>The content index in the db dir (the glob also matches its .closure sibling).</summary>
60+ private static string IndexFile ( string dbDir ) =>
61+ Directory . GetFiles ( dbDir , "index.Consumer.*" ) . Single ( f => ! f . EndsWith ( ".closure" ) ) ;
62+
5863 /// <summary>Run the built consumer: it loads content by rooted and bare (aliased) URLs.</summary>
5964 private void AssertRuntimeContentResolves ( string consumerDir )
6065 {
@@ -88,7 +93,7 @@ public void PluginUrlsIdenticalViaProjectReference()
8893 Assert . DoesNotContain ( UnresolvedSpinScript , result . Output ) ;
8994
9095 var dbDir = Path . Combine ( consumerDir , "obj" , "stride" , "assetbuild" , "data" , "db" ) ;
91- var index = File . ReadAllText ( Directory . GetFiles ( dbDir , "index.Consumer.*" ) [ 0 ] ) ;
96+ var index = File . ReadAllText ( IndexFile ( dbDir ) ) ;
9297 Assert . Matches ( @"(?m)^/StrideAssetPlugin/PluginPage " , index ) ;
9398 Assert . Matches ( @"(?m)^/Consumer/Page " , index ) ;
9499
0 commit comments