33using System . IO ;
44using System . Linq ;
55using System . Text . RegularExpressions ;
6+ using System . Threading . Tasks ;
67using NUnit . Framework ;
78using UnityDataTools . TestCommon ;
89using UnityDataTools . FileSystem ;
@@ -43,19 +44,19 @@ public void Teardown()
4344 }
4445
4546 [ Test ]
46- public void ArchiveExtract_FilesExtractedSuccessfully (
47+ public async Task ArchiveExtract_FilesExtractedSuccessfully (
4748 [ Values ( "" , "-o archive" , "--output-path archive" ) ] string options )
4849 {
4950 var path = Path . Combine ( Context . UnityDataFolder , "assetbundle" ) ;
5051
51- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "archive" , "extract" , path } . Concat ( options . Split ( " " , StringSplitOptions . RemoveEmptyEntries ) ) . ToArray ( ) ) ) ;
52+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "archive" , "extract" , path } . Concat ( options . Split ( " " , StringSplitOptions . RemoveEmptyEntries ) ) . ToArray ( ) ) ) ;
5253 Assert . IsTrue ( File . Exists ( Path . Combine ( m_TestOutputFolder , "archive" , "CAB-5d40f7cad7c871cf2ad2af19ac542994" ) ) ) ;
5354 Assert . IsTrue ( File . Exists ( Path . Combine ( m_TestOutputFolder , "archive" , "CAB-5d40f7cad7c871cf2ad2af19ac542994.resS" ) ) ) ;
5455 Assert . IsTrue ( File . Exists ( Path . Combine ( m_TestOutputFolder , "archive" , "CAB-5d40f7cad7c871cf2ad2af19ac542994.resource" ) ) ) ;
5556 }
5657
5758 [ Test ]
58- public void ArchiveList_ListFilesCorrectly ( )
59+ public async Task ArchiveList_ListFilesCorrectly ( )
5960 {
6061 var path = Path . Combine ( Context . UnityDataFolder , "assetbundle" ) ;
6162
@@ -64,7 +65,7 @@ public void ArchiveList_ListFilesCorrectly()
6465 var currentOut = Console . Out ;
6566 Console . SetOut ( sw ) ;
6667
67- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "archive" , "list" , path } ) ) ;
68+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "archive" , "list" , path } ) ) ;
6869
6970 var lines = sw . ToString ( ) . Split ( sw . NewLine ) ;
7071
@@ -84,13 +85,13 @@ public void ArchiveList_ListFilesCorrectly()
8485 }
8586
8687 [ Test ]
87- public void DumpText_DefaultArgs_TextFileCreatedCorrectly (
88+ public async Task DumpText_DefaultArgs_TextFileCreatedCorrectly (
8889 [ Values ( "" , "-f text" , "--output-format text" ) ] string options )
8990 {
9091 var path = Path . Combine ( Context . UnityDataFolder , "assetbundle" ) ;
9192 var outputFile = Path . Combine ( m_TestOutputFolder , "CAB-5d40f7cad7c871cf2ad2af19ac542994.txt" ) ;
9293
93- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "dump" , path } . Concat ( options . Split ( " " , StringSplitOptions . RemoveEmptyEntries ) ) . ToArray ( ) ) ) ;
94+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "dump" , path } . Concat ( options . Split ( " " , StringSplitOptions . RemoveEmptyEntries ) ) . ToArray ( ) ) ) ;
9495 Assert . IsTrue ( File . Exists ( outputFile ) ) ;
9596
9697 var content = File . ReadAllText ( outputFile ) ;
@@ -104,13 +105,13 @@ public void DumpText_DefaultArgs_TextFileCreatedCorrectly(
104105 }
105106
106107 [ Test ]
107- public void DumpText_SkipLargeArrays_TextFileCreatedCorrectly (
108+ public async Task DumpText_SkipLargeArrays_TextFileCreatedCorrectly (
108109 [ Values ( "-s" , "--skip-large-arrays" ) ] string options )
109110 {
110111 var path = Path . Combine ( Context . UnityDataFolder , "assetbundle" ) ;
111112 var outputFile = Path . Combine ( m_TestOutputFolder , "CAB-5d40f7cad7c871cf2ad2af19ac542994.txt" ) ;
112113
113- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "dump" , path } . Concat ( options . Split ( " " , StringSplitOptions . RemoveEmptyEntries ) ) . ToArray ( ) ) ) ;
114+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "dump" , path } . Concat ( options . Split ( " " , StringSplitOptions . RemoveEmptyEntries ) ) . ToArray ( ) ) ) ;
114115 Assert . IsTrue ( File . Exists ( outputFile ) ) ;
115116
116117 var content = File . ReadAllText ( outputFile ) ;
@@ -124,48 +125,48 @@ public void DumpText_SkipLargeArrays_TextFileCreatedCorrectly(
124125 }
125126
126127 [ Test ]
127- public void Analyze_DefaultArgs_DatabaseCorrect ( )
128+ public async Task Analyze_DefaultArgs_DatabaseCorrect ( )
128129 {
129130 var databasePath = Path . Combine ( m_TestOutputFolder , "database.db" ) ;
130131 var analyzePath = Path . Combine ( Context . UnityDataFolder ) ;
131132
132- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "analyze" , analyzePath } ) ) ;
133+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , analyzePath } ) ) ;
133134
134135 ValidateDatabase ( databasePath , false ) ;
135136 }
136137
137138 [ Test ]
138- public void Analyze_WithRefs_DatabaseCorrect (
139+ public async Task Analyze_WithRefs_DatabaseCorrect (
139140 [ Values ( "-r" , "--extract-references" ) ] string options )
140141 {
141142 var databasePath = Path . Combine ( m_TestOutputFolder , "database.db" ) ;
142143 var analyzePath = Path . Combine ( Context . UnityDataFolder ) ;
143144
144- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
145+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
145146
146147 ValidateDatabase ( databasePath , true ) ;
147148 }
148149
149150 [ Test ]
150- public void Analyze_WithPattern_DatabaseCorrect (
151+ public async Task Analyze_WithPattern_DatabaseCorrect (
151152 [ Values ( "-p *." , "--search-pattern *." ) ] string options )
152153 {
153154 var databasePath = Path . Combine ( m_TestOutputFolder , "database.db" ) ;
154155 var analyzePath = Path . Combine ( Context . UnityDataFolder ) ;
155156
156- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
157+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
157158
158159 ValidateDatabase ( databasePath , false ) ;
159160 }
160161
161162 [ Test ]
162- public void Analyze_WithPatternNoMatch_DatabaseEmpty (
163+ public async Task Analyze_WithPatternNoMatch_DatabaseEmpty (
163164 [ Values ( "-p *.x" , "--search-pattern *.x" ) ] string options )
164165 {
165166 var databasePath = Path . Combine ( m_TestOutputFolder , "database.db" ) ;
166167 var analyzePath = Path . Combine ( Context . UnityDataFolder ) ;
167168
168- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
169+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
169170
170171 using var db = new SQLiteConnection ( $ "Data Source={ databasePath } ;Version=3;New=True;Foreign Keys=False;") ;
171172 db . Open ( ) ;
@@ -179,13 +180,13 @@ public void Analyze_WithPatternNoMatch_DatabaseEmpty(
179180 }
180181
181182 [ Test ]
182- public void Analyze_WithOutputFile_DatabaseCorrect (
183+ public async Task Analyze_WithOutputFile_DatabaseCorrect (
183184 [ Values ( "-o my_database" , "--output-file my_database" ) ] string options )
184185 {
185186 var databasePath = Path . Combine ( m_TestOutputFolder , "my_database" ) ;
186187 var analyzePath = Path . Combine ( Context . UnityDataFolder ) ;
187188
188- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
189+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , analyzePath } . Concat ( options . Split ( " " ) ) . ToArray ( ) ) ) ;
189190
190191 ValidateDatabase ( databasePath , false ) ;
191192 }
@@ -262,12 +263,12 @@ public void Teardown()
262263 }
263264
264265 [ Test ]
265- public void Analyze_PlayerData_DatabaseCorrect ( )
266+ public async Task Analyze_PlayerData_DatabaseCorrect ( )
266267 {
267268 var databasePath = Path . Combine ( m_TestOutputFolder , "database.db" ) ;
268269 var analyzePath = Path . Combine ( Context . UnityDataFolder ) ;
269270
270- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "analyze" , analyzePath , "-r" } ) ) ;
271+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "analyze" , analyzePath , "-r" } ) ) ;
271272
272273 using var db = new SQLiteConnection ( $ "Data Source={ databasePath } ;Version=3;New=True;Foreign Keys=False;") ;
273274 db . Open ( ) ;
@@ -293,12 +294,12 @@ public void Analyze_PlayerData_DatabaseCorrect()
293294 }
294295
295296 [ Test ]
296- public void DumpText_PlayerData_TextFileCreatedCorrectly ( )
297+ public async Task DumpText_PlayerData_TextFileCreatedCorrectly ( )
297298 {
298299 var path = Path . Combine ( Context . UnityDataFolder , "level0" ) ;
299300 var outputFile = Path . Combine ( m_TestOutputFolder , "level0.txt" ) ;
300301
301- Assert . AreEqual ( 0 , Program . Main ( new string [ ] { "dump" , path } ) ) ;
302+ Assert . AreEqual ( 0 , await Program . Main ( new string [ ] { "dump" , path } ) ) ;
302303 Assert . IsTrue ( File . Exists ( outputFile ) ) ;
303304
304305 var content = File . ReadAllText ( outputFile ) ;
0 commit comments