Exemplo n.º 1
0
        public async Task TestInvokeAsync_ExecutesPowerShell()
        {
            const string expectedValue = "expectedValue";

            using (PowerShell powerShell = PowerShell.Create())
            {
                powerShell.AddVariable("varName", expectedValue);
                powerShell.AddScript("Write-Output $varName");

                PSDataCollection <PSObject> results = await powerShell.InvokeAsync();

                Assert.AreEqual(expectedValue, results.Single().BaseObject);
            }
        }