31 lines
932 B
C#
31 lines
932 B
C#
namespace FinalFactory.Rendezvous.Tests.Contracts;
|
|
|
|
internal static class ContractTestFiles
|
|
{
|
|
public static string Read(string fileName) => File
|
|
.ReadAllText(Path.Combine(Directory, fileName))
|
|
.TrimEnd('\r', '\n');
|
|
|
|
public static string Directory
|
|
{
|
|
get
|
|
{
|
|
DirectoryInfo? directory = new(AppContext.BaseDirectory);
|
|
while (directory is not null)
|
|
{
|
|
string solution = Path.Combine(directory.FullName, "Rendezvous.slnx");
|
|
if (File.Exists(solution))
|
|
{
|
|
return Path.Combine(
|
|
directory.FullName,
|
|
"tests/FinalFactory.Rendezvous.Tests/TestData/Contracts/v1");
|
|
}
|
|
|
|
directory = directory.Parent;
|
|
}
|
|
|
|
throw new DirectoryNotFoundException("Could not locate contract test data.");
|
|
}
|
|
}
|
|
}
|