10
10
11
11
namespace Microsoft . NET . Sdk . WebAssembly . Tests
12
12
{
13
- public static class ConvertDllsToWebCilTests
13
+ public class ConvertDllsToWebCilTests
14
14
{
15
- private static ConvertDllsToWebCil task ;
16
- private static List < BuildErrorEventArgs > errors ;
15
+ private ConvertDllsToWebCil task ;
16
+ private List < BuildErrorEventArgs > errors ;
17
17
18
- static ConvertDllsToWebCilTests ( )
18
+ public ConvertDllsToWebCilTests ( )
19
19
{
20
20
task = new ConvertDllsToWebCil ( ) ;
21
21
var buildEngine = new Mock < IBuildEngine > ( ) ;
@@ -25,7 +25,7 @@ static ConvertDllsToWebCilTests()
25
25
}
26
26
27
27
[ Fact ]
28
- public static void TestEmptyInput ( )
28
+ public void TestEmptyInput ( )
29
29
{
30
30
string input = Path . Combine ( Path . GetTempPath ( ) , Path . GetRandomFileName ( ) + ".dll" ) ;
31
31
@@ -49,5 +49,29 @@ public static void TestEmptyInput()
49
49
}
50
50
}
51
51
52
+ [ Fact ]
53
+ public void TestInvalidDirectoryInput ( )
54
+ {
55
+ string input = Path . Combine ( Path . GetTempPath ( ) , Path . GetRandomFileName ( ) + ".dll" ) ;
56
+
57
+ try
58
+ {
59
+ Directory . CreateDirectory ( input ) ;
60
+
61
+ task . Candidates = new ITaskItem [ ] { new TaskItem ( input ) } ;
62
+ task . IsEnabled = true ;
63
+ task . OutputPath = task . IntermediateOutputPath = Path . GetTempPath ( ) ;
64
+
65
+ bool result = task . Execute ( ) ;
66
+
67
+ Assert . False ( result ) ;
68
+ Assert . Single ( errors ) ;
69
+ Assert . Contains ( input , errors [ 0 ] . Message ) ;
70
+ }
71
+ finally
72
+ {
73
+ Directory . Delete ( input ) ;
74
+ }
75
+ }
52
76
}
53
77
}
0 commit comments