Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from hartmark/AssemblyLocationNamer
Add new namer that looks for approval files in same folder as assembly
- Loading branch information
Showing
2 changed files
with
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
namespace ApprovalTests.Namers | ||
{ | ||
public class AssemblyLocationNamer : UnitTestFrameworkNamer | ||
{ | ||
private string AssemblyDirectory | ||
{ | ||
get | ||
{ | ||
// CodeBase is used because the NUnit test runner is otherwise quirky | ||
var codeBase = Assembly.GetExecutingAssembly().CodeBase; | ||
var uri = new UriBuilder(codeBase); | ||
var path = Uri.UnescapeDataString(uri.Path); | ||
return Path.GetDirectoryName(path); | ||
} | ||
} | ||
|
||
public override string SourcePath => AssemblyDirectory + GetSubdirectory(); | ||
} | ||
} |
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