Skip to content

Commit 04dd089

Browse files
committed
Add TestUtilities.GetSharedPath()
1 parent 3c4e48e commit 04dd089

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

test/PowerShellEditorServices.Test.Shared/TestUtilities/TestUtilities.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ public static string NormalizePath(string unixPath)
3636
return unixPath;
3737
}
3838

39+
/// <summary>
40+
/// Gets a normalized path from the directory of this assembly to the given path under the
41+
/// shared test folder.
42+
/// </summary>
43+
/// <param name="path">A path or file under the shared test folder.</param>
44+
/// <returns>The normalized and resolved path to it.</returns>
45+
public static string GetSharedPath(string path)
46+
{
47+
// TODO: When testing net461 with x64 host, another .. is needed!
48+
return NormalizePath(Path.Combine(
49+
Path.GetDirectoryName(typeof(TestUtilities).Assembly.Location),
50+
"../../../../PowerShellEditorServices.Test.Shared",
51+
path));
52+
}
53+
3954
/// <summary>
4055
/// Take a string with UNIX newlines and replaces them with platform-appropriate newlines.
4156
/// </summary>

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,7 @@ private void OnDebuggerStopped(object sender, DebuggerStoppedEventArgs e)
8181

8282
private ScriptFile GetDebugScript(string fileName)
8383
{
84-
return workspace.GetFile(
85-
TestUtilities.NormalizePath(Path.Combine(
86-
Path.GetDirectoryName(typeof(DebugServiceTests).Assembly.Location),
87-
// TODO: When testing net461 with x64 host, another .. is needed!
88-
"../../../../PowerShellEditorServices.Test.Shared/Debugging",
89-
fileName
90-
)));
84+
return workspace.GetFile(TestUtilities.GetSharedPath(Path.Combine("Debugging", fileName)));
9185
}
9286

9387
private Task ExecutePowerShellCommand(string command, params string[] args)

0 commit comments

Comments
 (0)