public async Task ReadLine_Exception2_Tests()
        {
            using (var client = new PSClient())
            {
                await client.OpenAsync(PSConnectionInfo.CreateLocalConnection());

                await Task.Delay(TimeSpan.FromMilliseconds(100));

                client.ConfigureNonInteractiveConsoleHost();
                await Assert.ThrowsExceptionAsync <CmdletInvocationException>(async() => await client.InvokeScriptAsync <string>("Read-Host"));
            }
        }
        public async Task ReadLine_Test()
        {
            using (var client = new PSClient())
            {
                await client.OpenAsync(PSConnectionInfo.CreateLocalConnection());

                await Task.Delay(TimeSpan.FromMilliseconds(100));

                client.ConfigureNonInteractiveConsoleHost();

                client.HostUI.ReadLineCallback = () => "Hello World";
                Assert.AreEqual("Hello World", (await client.InvokeScriptAsync <string>("Read-Host")).Single());
            }
        }
        public async Task TestWriteHost2()
        {
            using (var client = new PSClient())
            {
                await client.OpenAsync(PSConnectionInfo.CreateLocalConnection());
                client.ConfigureNonInteractiveConsoleHost();
                string v = string.Empty;

                var oldCallback = client.HostUI.WriteCallback;
                client.HostUI.WriteCallback = (s, fg, bg, c) =>
                {
                    if (s == PSOutputStream.Default)
                    {
                        v += c;
                    }

                    oldCallback?.Invoke(s, fg, bg, c);
                };
                await client.InvokeScriptAsync("Write-Host \"Hello World\";");

                Assert.AreEqual("Hello World", v.Trim());
                Assert.IsTrue(v.EndsWith("\n"));
            }
        }