Skip to content

Commit cc71a7e

Browse files
committed
Clean up PsesHostFactory
* Remove unused field * Fix some indentation * Name all arguments * Delete TODO that's been answered
1 parent a91a1f0 commit cc71a7e

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

test/PowerShellEditorServices.Test/PsesHostFactory.cs

+12-21
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,13 @@ internal static class PsesHostFactory
2020
// NOTE: These paths are arbitrarily chosen just to verify that the profile paths can be set
2121
// to whatever they need to be for the given host.
2222

23-
public static readonly ProfilePathInfo TestProfilePaths =
24-
new(
25-
Path.GetFullPath(
26-
TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/Profile/Test.PowerShellEditorServices_profile.ps1")),
27-
Path.GetFullPath(
28-
TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/Profile/ProfileTest.ps1")),
29-
Path.GetFullPath(
30-
TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/Test.PowerShellEditorServices_profile.ps1")),
31-
Path.GetFullPath(
32-
TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/ProfileTest.ps1")));
23+
public static readonly ProfilePathInfo TestProfilePaths = new(
24+
Path.GetFullPath(TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/Profile/Test.PowerShellEditorServices_profile.ps1")),
25+
Path.GetFullPath(TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/Profile/ProfileTest.ps1")),
26+
Path.GetFullPath(TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/Test.PowerShellEditorServices_profile.ps1")),
27+
Path.GetFullPath(TestUtilities.NormalizePath("../../../../PowerShellEditorServices.Test.Shared/ProfileTest.ps1")));
3328

34-
public static readonly string BundledModulePath = Path.GetFullPath(
35-
TestUtilities.NormalizePath("../../../../../module"));
36-
37-
public static System.Management.Automation.Runspaces.Runspace InitialRunspace;
29+
public static readonly string BundledModulePath = Path.GetFullPath(TestUtilities.NormalizePath("../../../../../module"));
3830

3931
public static PsesInternalHost Create(ILoggerFactory loggerFactory)
4032
{
@@ -53,24 +45,23 @@ public static PsesInternalHost Create(ILoggerFactory loggerFactory)
5345
}
5446

5547
HostStartupInfo testHostDetails = new(
56-
"PowerShell Editor Services Test Host",
57-
"Test.PowerShellEditorServices",
58-
new Version("1.0.0"),
48+
name: "PowerShell Editor Services Test Host",
49+
profileId: "Test.PowerShellEditorServices",
50+
version: new Version("1.0.0"),
5951
psHost: new NullPSHost(),
60-
TestProfilePaths,
52+
profilePaths: TestProfilePaths,
6153
featureFlags: Array.Empty<string>(),
6254
additionalModules: Array.Empty<string>(),
63-
initialSessionState,
55+
initialSessionState: initialSessionState,
6456
logPath: null,
65-
(int)LogLevel.None,
57+
logLevel: (int)LogLevel.None,
6658
consoleReplEnabled: false,
6759
usesLegacyReadLine: false,
6860
bundledModulePath: BundledModulePath);
6961

7062
var psesHost = new PsesInternalHost(loggerFactory, null, testHostDetails);
7163

7264
// NOTE: Because this is used by constructors it can't use await.
73-
// TODO: Should we actually load profiles here?
7465
if (psesHost.TryStartAsync(new HostStartOptions { LoadProfiles = true }, CancellationToken.None).GetAwaiter().GetResult())
7566
{
7667
return psesHost;

0 commit comments

Comments
 (0)