-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Reproduced the bug in the CI * Added unit tests for the issue * Fixed "Path cannot be the empty string or all whitespace."
- Loading branch information
Showing
3 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
tests/trx2junit.Tests/WorkerTests/RunAsync/LocationIsPwd.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
|
||
namespace trx2junit.Tests.WorkerTests.RunAsync | ||
{ | ||
[TestFixture] | ||
public class LocationIsPwd | ||
{ | ||
private string _curDir; | ||
//--------------------------------------------------------------------- | ||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_curDir = Environment.CurrentDirectory; | ||
Environment.CurrentDirectory = "./data"; | ||
} | ||
//--------------------------------------------------------------------- | ||
[TearDown] | ||
public void TearDown() | ||
{ | ||
Environment.CurrentDirectory = _curDir; | ||
} | ||
//--------------------------------------------------------------------- | ||
[Test] | ||
public async Task Single_file_given___converted() | ||
{ | ||
string[] expectedFiles = { "nunit.xml" }; | ||
DeleteExpectedFiles(expectedFiles); | ||
|
||
var sut = new Worker(); | ||
|
||
string[] args = { "nunit.trx" }; | ||
var options = new WorkerOptions(args); | ||
await sut.RunAsync(options); | ||
|
||
CheckExpectedFilesExist(expectedFiles); | ||
} | ||
//--------------------------------------------------------------------- | ||
[Test] | ||
public async Task Multiple_files_given___converted() | ||
{ | ||
string[] expectedFiles = { "nunit.xml", "mstest.xml", "mstest-warning.xml" }; | ||
DeleteExpectedFiles(expectedFiles); | ||
|
||
var sut = new Worker(); | ||
|
||
string[] args = { "nunit.trx", "mstest.trx", "mstest-warning.trx" }; | ||
var options = new WorkerOptions(args); | ||
await sut.RunAsync(options); | ||
|
||
CheckExpectedFilesExist(expectedFiles); | ||
} | ||
//--------------------------------------------------------------------- | ||
private static void DeleteExpectedFiles(string[] files) | ||
{ | ||
foreach (string file in files) | ||
File.Delete(file); | ||
} | ||
//--------------------------------------------------------------------- | ||
private static void CheckExpectedFilesExist(string[] files) | ||
{ | ||
Assert.Multiple(() => | ||
{ | ||
foreach (string file in files) | ||
{ | ||
bool actual = File.Exists(file); | ||
Assert.IsTrue(actual, $"File '{file}' does not exist"); | ||
} | ||
}); | ||
} | ||
} | ||
} |