Exemple #1
0
        public override void Dispose()
        {
            var stopCommand = new Command("Stop-GrainClient");

            Powershell.Commands.Clear();
            Powershell.Commands.AddCommand(stopCommand);
            Powershell.Invoke();
            Powershell.Dispose();
            Runspace.Dispose();
            base.Dispose();
        }
Exemple #2
0
        public PowershellHostFixture()
        {
            var initialSessionState = InitialSessionState.CreateDefault();

            initialSessionState.Commands.Add(new SessionStateCmdletEntry("Start-GrainClient", typeof(StartGrainClient), null));
            initialSessionState.Commands.Add(new SessionStateCmdletEntry("Stop-GrainClient", typeof(StopGrainClient), null));
            initialSessionState.Commands.Add(new SessionStateCmdletEntry("Get-Grain", typeof(GetGrain), null));
            Runspace = RunspaceFactory.CreateRunspace(initialSessionState);
            Runspace.Open();
            Powershell          = PowerShell.Create();
            Powershell.Runspace = Runspace;

            var stopGrainClient = new Command("Stop-GrainClient");

            Powershell.Commands.AddCommand(stopGrainClient);
            Powershell.Invoke();
        }