public void RunCommand_ShouldRunCommandWithSwitchParameter(object switchParameterValue)
        {
            var session = PowerShell.CreateSession();

            session.PowerShell.AddScript(@"
function Test-Switch { 
    param([switch] $switchy) 
    $switchy.IsPresent 
}", false);
            session.PowerShell.Invoke();
            session.PowerShell.Commands.Clear();

            var result = PowerShell.RunCommand(new RunCommandInput
            {
                Command    = "Test-Switch",
                Parameters = new[]
                {
                    new PowerShellParameter
                    {
                        Name  = "switchy",
                        Value = switchParameterValue
                    }
                },
                LogInformationStream = true
            },
                                               new RunOptions
            {
                Session = session
            });

            Assert.That(result.Result.Single(), Is.EqualTo(switchParameterValue));
        }
        public void RunCommandAndScript_ShouldUseSharedSession()
        {
            var session = PowerShell.CreateSession();

            var result1 = PowerShell.RunScript(new RunScriptInput
            {
                ReadFromFile         = false,
                Script               = "$timespan = $timespan + (new-timespan -hours 1)",
                LogInformationStream = true
            },
                                               new RunOptions
            {
                Session = session
            });

            var result2 = PowerShell.RunScript(new RunScriptInput
            {
                ReadFromFile         = false,
                Script               = "(new-timespan -hours 1) + $timespan",
                LogInformationStream = true
            },
                                               new RunOptions
            {
                Session = session
            });

            Assert.That(result2.Result.Single(), Is.EqualTo(TimeSpan.FromHours(2)));
        }