Skip to content

Commit

Permalink
add another test
Browse files Browse the repository at this point in the history
  • Loading branch information
danmoseley committed Apr 17, 2024
1 parent ac61c3a commit 19c0e5c
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions src/tasks/tests/ConvertDllsToWebCilTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

namespace Microsoft.NET.Sdk.WebAssembly.Tests
{
public static class ConvertDllsToWebCilTests
public class ConvertDllsToWebCilTests
{
private static ConvertDllsToWebCil task;
private static List<BuildErrorEventArgs> errors;
private ConvertDllsToWebCil task;
private List<BuildErrorEventArgs> errors;

static ConvertDllsToWebCilTests()
public ConvertDllsToWebCilTests()
{
task = new ConvertDllsToWebCil();
var buildEngine = new Mock<IBuildEngine>();
Expand All @@ -25,7 +25,7 @@ static ConvertDllsToWebCilTests()
}

[Fact]
public static void TestEmptyInput()
public void TestEmptyInput()
{
string input = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".dll");

Expand All @@ -49,5 +49,29 @@ public static void TestEmptyInput()
}
}

[Fact]
public void TestInvalidDirectoryInput()
{
string input = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".dll");

try
{
Directory.CreateDirectory(input);

task.Candidates = new ITaskItem[] { new TaskItem(input) };
task.IsEnabled = true;
task.OutputPath = task.IntermediateOutputPath = Path.GetTempPath();

bool result = task.Execute();

Assert.False(result);
Assert.Single(errors);
Assert.Contains(input, errors[0].Message);
}
finally
{
Directory.Delete(input);
}
}
}
}

0 comments on commit 19c0e5c

Please sign in to comment.