Skip to content

Commit f7b69d5

Browse files
committed
Add test CanGetPSReadLineProxy
Which asserts that we can successfully load PSReadLine.
1 parent 75a7175 commit f7b69d5

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/Session/PSReadLinePromptContext.cs

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ internal class PSReadLinePromptContext : IPromptContext
2222
"..",
2323
"..",
2424
"..",
25+
#if TEST
26+
// When using xUnit (dotnet test) the assemblies are deployed to the
27+
// test project folder, invalidating our relative path assumption.
28+
"..",
29+
"..",
30+
"module",
31+
#endif
2532
"PSReadLine");
2633

2734
private static readonly Lazy<CmdletInfo> s_lazyInvokeReadLineForEditorServicesCmdletInfo = new Lazy<CmdletInfo>(() =>

test/PowerShellEditorServices.Test/Session/PowerShellContextTests.cs

+10
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ await this.powerShellContext.ExecuteCommandAsync<string>(
143143
Assert.Equal(expectedString, result.FirstOrDefault(), true);
144144
}
145145

146+
[Trait("Category", "PSReadLine")]
147+
[Fact]
148+
public async Task CanGetPSReadLineProxy()
149+
{
150+
Assert.True(PSReadLinePromptContext.TryGetPSReadLineProxy(
151+
NullLogger.Instance,
152+
PowerShellContextFactory.initialRunspace,
153+
out PSReadLineProxy proxy));
154+
}
155+
146156
#region Helper Methods
147157

148158
private async Task AssertStateChange(PowerShellContextState expectedState)

0 commit comments

Comments
 (0)