-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure benchmark results are exported to sensible directory.
- Loading branch information
Showing
5 changed files
with
96 additions
and
12 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using static Atmoos.GlassView.Export.Extensions; | ||
|
||
namespace Atmoos.GlassView.Export.Test; | ||
|
||
public class ExtensionsTest | ||
{ | ||
|
||
[Fact] | ||
public void FindLeafFindsExistingLeafDirInSomeToplevelDirectory() | ||
{ | ||
const String directoryName = "someExistingLeafDir"; | ||
DirectoryInfo expected = MoveUp(CurrentDirectory(), levels: 3).CreateSubdirectory(directoryName); | ||
try { | ||
DirectoryInfo actual = FindLeaf(directoryName); | ||
|
||
Assert.Equal(expected.FullName, actual.FullName); | ||
Assert.True(expected.Exists, "The expected directory should exist after the test."); | ||
} | ||
finally { | ||
expected.Delete(true); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void FindLeafReturnsCreatedLeafDirInCurrentDirectoryWhenItCannotBeFound() | ||
{ | ||
const String directoryName = "someLeafDirThatDoesNotExist"; | ||
var expected = new DirectoryInfo(Path.Combine(CurrentDirectory().FullName, directoryName)); | ||
Assert.False(expected.Exists, "The expected directory should not exist before the test."); | ||
|
||
try { | ||
|
||
DirectoryInfo actual = FindLeaf(directoryName); | ||
|
||
Assert.Equal(expected.FullName, actual.FullName); | ||
Assert.True(actual.Exists, "The expected directory should exist after the test."); | ||
} | ||
finally { | ||
expected.Delete(true); | ||
} | ||
} | ||
|
||
private static DirectoryInfo MoveUp(DirectoryInfo directory, Int32 levels) | ||
{ | ||
for (; directory.Parent != null && levels-- > 0; directory = directory.Parent) { } | ||
return directory; | ||
} | ||
} |
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
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