11using System ;
2+ using System . Collections . Generic ;
23using System . IO ;
34using System . Threading . Tasks ;
45using Confuser . Core ;
@@ -17,20 +18,16 @@ public class MessageDeobfuscationTest : TestBase {
1718
1819 public MessageDeobfuscationTest ( ITestOutputHelper outputHelper ) : base ( outputHelper ) { }
1920
20- [ Fact ]
21+ [ Theory ]
22+ [ MemberData ( nameof ( RenameModeAndExpectedObfuscatedOutput ) ) ]
2123 [ Trait ( "Category" , "Protection" ) ]
2224 [ Trait ( "Protection" , "rename" ) ]
23- public async Task MessageDeobfuscationWithSymbolsMap ( ) {
24- var expectedObfuscatedOutput = new [ ] {
25- "Exception" ,
26- " at _OokpKOmal5JNZMPvSAFgHLHjBke._tc5CFDIJ2J9Fx3ehd3sgjTMAxCaA._8Tq88jpv7mEXkEMavg6AaMFsXJt(String )" ,
27- " at _ykdLsBmsKGrd6fxeEseqJs8XlpP._tfvbqapfg44suL8taZVvOKM4AoG()"
28- } ;
25+ public async Task MessageDeobfuscationWithSymbolsMap ( string renameMode , string [ ] expectedObfuscatedOutput ) =>
2926 await Run (
3027 "MessageDeobfuscation.exe" ,
3128 expectedObfuscatedOutput ,
32- new SettingItem < Protection > ( "rename" ) { [ "mode" ] = "decodable" } ,
33- "SymbolsMap ",
29+ new SettingItem < Protection > ( "rename" ) { [ "mode" ] = renameMode } ,
30+ $ "SymbolsMap_ { renameMode } ",
3431 seed : "1234" ,
3532 postProcessAction : outputPath => {
3633 var messageDeobfuscator = MessageDeobfuscator . Load ( Path . Combine ( outputPath , "symbols.map" ) ) ;
@@ -39,7 +36,26 @@ await Run(
3936 return Task . Delay ( 0 ) ;
4037 }
4138 ) ;
42- }
39+
40+ public static IEnumerable < object [ ] > RenameModeAndExpectedObfuscatedOutput ( ) =>
41+ new [ ] {
42+ new object [ ] {
43+ nameof ( RenameMode . Decodable ) ,
44+ new [ ] {
45+ "Exception" ,
46+ " at _OokpKOmal5JNZMPvSAFgHLHjBke._tc5CFDIJ2J9Fx3ehd3sgjTMAxCaA._8Tq88jpv7mEXkEMavg6AaMFsXJt(String )" ,
47+ " at _ykdLsBmsKGrd6fxeEseqJs8XlpP._tfvbqapfg44suL8taZVvOKM4AoG()"
48+ }
49+ } ,
50+ new object [ ] {
51+ nameof ( RenameMode . Sequential ) ,
52+ new [ ] {
53+ "Exception" ,
54+ " at _A._C._b(String )" ,
55+ " at _B._c()"
56+ }
57+ }
58+ } ;
4359
4460 [ Fact ]
4561 [ Trait ( "Category" , "Protection" ) ]
0 commit comments