Skip to content

Commit 7b90cb6

Browse files
authored
Merge pull request #13 from Dor-bl/TestApp_Path
Avoid using relative path for WpfApplication
2 parents 583d2bf + 1c2d4af commit 7b90cb6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
using System.IO;
2+
using System.Linq;
23

34
namespace FlaUI.WebDriver.UITests.TestUtil
45
{
56
public static class TestApplication
67
{
7-
public static string FullPath => Path.GetFullPath("..\\..\\..\\..\\TestApplications\\WpfApplication\\bin\\Release\\WpfApplication.exe");
8-
}
8+
9+
private static readonly string s_currentDirectory = Directory.GetCurrentDirectory();
10+
private static readonly string s_solutionDirectory = FindSolutionDirectory(s_currentDirectory);
11+
12+
private static string FindSolutionDirectory(string currentDirectory)
13+
{
14+
while (!Directory.GetFiles(currentDirectory, "*.sln").Any())
15+
{
16+
currentDirectory = Directory.GetParent(currentDirectory).FullName;
17+
}
18+
return currentDirectory;
19+
}
20+
21+
public static string FullPath => Path.Combine(s_solutionDirectory, "TestApplications", "WpfApplication", "bin", "Release", "WpfApplication.exe");
22+
}
23+
924
}

0 commit comments

Comments
 (0)