2020-03-24 19:08:37 +01:00
|
|
|
// Copyright (c) Microsoft Corporation.
|
2018-02-13 18:23:53 +01:00
|
|
|
// Licensed under the MIT License.
|
2018-12-18 17:11:21 +01:00
|
|
|
|
2016-03-17 10:31:04 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Management.Automation;
|
|
|
|
using System.Management.Automation.Host;
|
|
|
|
using System.Management.Automation.Internal;
|
|
|
|
using System.Management.Automation.Internal.Host;
|
|
|
|
using System.Management.Automation.Runspaces;
|
|
|
|
using Microsoft.PowerShell;
|
2018-12-18 17:11:21 +01:00
|
|
|
using Xunit;
|
2016-03-17 10:31:04 +01:00
|
|
|
|
2018-01-03 21:43:28 +01:00
|
|
|
namespace PSTests.Parallel
|
2016-03-17 10:31:04 +01:00
|
|
|
{
|
|
|
|
public class SessionStateTests
|
|
|
|
{
|
2017-11-30 23:44:41 +01:00
|
|
|
[SkippableFact]
|
2016-03-17 10:31:04 +01:00
|
|
|
public void TestDrives()
|
|
|
|
{
|
2017-11-30 23:44:41 +01:00
|
|
|
Skip.IfNot(Platform.IsWindows);
|
2016-03-18 03:11:41 +01:00
|
|
|
CultureInfo currentCulture = CultureInfo.CurrentCulture;
|
2018-12-18 17:11:21 +01:00
|
|
|
PSHost hostInterface = new DefaultHost(currentCulture, currentCulture);
|
2016-03-18 03:11:41 +01:00
|
|
|
InitialSessionState iss = InitialSessionState.CreateDefault2();
|
2017-11-29 18:38:04 +01:00
|
|
|
AutomationEngine engine = new AutomationEngine(hostInterface, iss);
|
2016-03-18 03:11:41 +01:00
|
|
|
ExecutionContext executionContext = new ExecutionContext(engine, hostInterface, iss);
|
2016-03-17 10:31:04 +01:00
|
|
|
SessionStateInternal sessionState = new SessionStateInternal(executionContext);
|
|
|
|
Collection<PSDriveInfo> drives = sessionState.Drives(null);
|
2016-03-18 04:18:29 +01:00
|
|
|
Assert.NotNull(drives);
|
2016-03-17 10:31:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|