11using System ;
2+ using System . Collections . Generic ;
23using System . Diagnostics ;
34using System . IO ;
45using System . Threading . Tasks ;
56using Confuser . Core ;
67using Confuser . Core . Project ;
8+ using Confuser . Renamer ;
79using Confuser . UnitTest ;
810using Xunit ;
911using Xunit . Abstractions ;
@@ -15,13 +17,15 @@ public class InheritCustomAttributeTest {
1517 public InheritCustomAttributeTest ( ITestOutputHelper outputHelper ) =>
1618 this . outputHelper = outputHelper ?? throw new ArgumentNullException ( nameof ( outputHelper ) ) ;
1719
18- [ Fact ]
20+ [ Theory ]
21+ [ MemberData ( nameof ( InheritCustomAttributeData ) ) ]
1922 [ Trait ( "Category" , "Protection" ) ]
2023 [ Trait ( "Protection" , "rename" ) ]
2124 [ Trait ( "Issue" , "https://github.com/mkaring/ConfuserEx/issues/123" ) ]
22- public async Task InheritCustomAttribute ( ) {
25+ [ Trait ( "Issue" , "https://github.com/mkaring/ConfuserEx/issues/161" ) ]
26+ public async Task InheritCustomAttribute ( string renameMode , bool flatten ) {
2327 var baseDir = Environment . CurrentDirectory ;
24- var outputDir = Path . Combine ( baseDir , "testtmp" ) ;
28+ var outputDir = Path . Combine ( baseDir , "testtmp_" + Guid . NewGuid ( ) . ToString ( ) ) ;
2529 var inputFile = Path . Combine ( baseDir , "123_InheritCustomAttr.exe" ) ;
2630 var outputFile = Path . Combine ( outputDir , "123_InheritCustomAttr.exe" ) ;
2731 FileUtilities . ClearOutput ( outputFile ) ;
@@ -31,7 +35,10 @@ public async Task InheritCustomAttribute() {
3135 } ;
3236 proj . Add ( new ProjectModule ( ) { Path = inputFile } ) ;
3337 proj . Rules . Add ( new Rule ( ) {
34- new SettingItem < Protection > ( "rename" )
38+ new SettingItem < Protection > ( "rename" ) {
39+ { "mode" , renameMode } ,
40+ { "flatten" , flatten ? "True" : "False" }
41+ }
3542 } ) ;
3643
3744 var parameters = new ConfuserParameters {
@@ -62,5 +69,11 @@ public async Task InheritCustomAttribute() {
6269
6370 FileUtilities . ClearOutput ( outputFile ) ;
6471 }
72+
73+ public static IEnumerable < object [ ] > InheritCustomAttributeData ( ) {
74+ foreach ( var renameMode in new string [ ] { nameof ( RenameMode . Unicode ) , nameof ( RenameMode . ASCII ) , nameof ( RenameMode . Letters ) , nameof ( RenameMode . Debug ) } )
75+ foreach ( var flatten in new bool [ ] { true , false } )
76+ yield return new object [ ] { renameMode , flatten } ;
77+ }
6578 }
6679}
0 commit comments