Skip to content

Commit 19c0e5c

Browse files
committed
add another test
1 parent ac61c3a commit 19c0e5c

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

src/tasks/tests/ConvertDllsToWebCilTests.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
namespace Microsoft.NET.Sdk.WebAssembly.Tests
1212
{
13-
public static class ConvertDllsToWebCilTests
13+
public class ConvertDllsToWebCilTests
1414
{
15-
private static ConvertDllsToWebCil task;
16-
private static List<BuildErrorEventArgs> errors;
15+
private ConvertDllsToWebCil task;
16+
private List<BuildErrorEventArgs> errors;
1717

18-
static ConvertDllsToWebCilTests()
18+
public ConvertDllsToWebCilTests()
1919
{
2020
task = new ConvertDllsToWebCil();
2121
var buildEngine = new Mock<IBuildEngine>();
@@ -25,7 +25,7 @@ static ConvertDllsToWebCilTests()
2525
}
2626

2727
[Fact]
28-
public static void TestEmptyInput()
28+
public void TestEmptyInput()
2929
{
3030
string input = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".dll");
3131

@@ -49,5 +49,29 @@ public static void TestEmptyInput()
4949
}
5050
}
5151

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+
}
5276
}
5377
}

0 commit comments

Comments
 (0)