Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
test_PowerShellAPI.cs25 linesDownload Raw Back to csharp
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System;5using System.Management.Automation;6using Xunit;7 8namespace PSTests.Sequential9{10    public static class PowerShellHostingScenario11    {12        [Fact]13        public static void TestStartJobThrowTerminatingException()14        {15            using (var ps = PowerShell.Create())16            {17                ps.AddCommand("Start-Job").AddParameter("ScriptBlock", ScriptBlock.Create("1+1"));18                var ex = Assert.Throws<CmdletInvocationException>(() => ps.Invoke());19                Assert.IsType<PSNotSupportedException>(ex.InnerException);20                Assert.Equal("IPCPwshExecutableNotFound,Microsoft.PowerShell.Commands.StartJobCommand", ex.ErrorRecord.FullyQualifiedErrorId);21            }22        }23    }24}25