46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
namespace MxGateway.IntegrationTests;
|
|
|
|
public sealed class IntegrationTestEnvironmentTests
|
|
{
|
|
[Fact]
|
|
public void LiveMxAccessTests_AreOptInByEnvironmentVariable()
|
|
{
|
|
Assert.Equal(
|
|
"MXGATEWAY_RUN_LIVE_MXACCESS_TESTS",
|
|
IntegrationTestEnvironment.LiveMxAccessVariableName);
|
|
}
|
|
|
|
[Fact]
|
|
public void LiveMxAccessWorkerExecutable_UsesDocumentedEnvironmentVariable()
|
|
{
|
|
Assert.Equal(
|
|
"MXGATEWAY_LIVE_MXACCESS_WORKER_EXE",
|
|
IntegrationTestEnvironment.LiveMxAccessWorkerExecutableVariableName);
|
|
}
|
|
|
|
[Fact]
|
|
public void ResolveRepositoryRoot_AcceptsGitWorktreeFile()
|
|
{
|
|
string temporaryRoot = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
|
|
string nestedDirectory = Path.Combine(temporaryRoot, "tests", "bin");
|
|
|
|
try
|
|
{
|
|
Directory.CreateDirectory(nestedDirectory);
|
|
Directory.CreateDirectory(Path.Combine(temporaryRoot, "src"));
|
|
File.WriteAllText(Path.Combine(temporaryRoot, ".git"), "gitdir: ../.git/worktrees/test");
|
|
|
|
string repositoryRoot = IntegrationTestEnvironment.ResolveRepositoryRoot(nestedDirectory);
|
|
|
|
Assert.Equal(temporaryRoot, repositoryRoot);
|
|
}
|
|
finally
|
|
{
|
|
if (Directory.Exists(temporaryRoot))
|
|
{
|
|
Directory.Delete(temporaryRoot, recursive: true);
|
|
}
|
|
}
|
|
}
|
|
}
|