diff --git a/BTCPayServer.Tests/TestUtils.cs b/BTCPayServer.Tests/TestUtils.cs index 47f1405e8..7e0788177 100644 --- a/BTCPayServer.Tests/TestUtils.cs +++ b/BTCPayServer.Tests/TestUtils.cs @@ -6,7 +6,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; -using NBitcoin; using OpenQA.Selenium; using Xunit; using Xunit.Sdk; @@ -22,7 +21,8 @@ namespace BTCPayServer.Tests #endif public static DirectoryInfo TryGetSolutionDirectoryInfo() { - var directory = new DirectoryInfo(TestDirectory); + var btcPayDirectory = ((OutputPathAttribute)typeof(TestUtils).Assembly.GetCustomAttributes(typeof(OutputPathAttribute), true)[0]).BuiltPath; + var directory = new DirectoryInfo(btcPayDirectory); while (directory != null && !directory.GetFiles("*.sln").Any()) { directory = directory.Parent; @@ -32,9 +32,9 @@ namespace BTCPayServer.Tests static TestUtils() { - TestDirectory = ((OutputPathAttribute)typeof(TestUtils).Assembly.GetCustomAttributes(typeof(OutputPathAttribute), true)[0]).BuiltPath; + TestDirectory = AppContext.BaseDirectory; } - public readonly static string TestDirectory; + public static readonly string TestDirectory; public static string GetTestDataFullPath(string relativeFilePath) {