示例#1
0
        public async Task Should_Excute_When_No_Args()
        {
            using (var client = new TerminalClient())
            {
                var result = await client.ExcuteAndReadOutputAsync(@"C:\", "cmd.exe", "/c dir");

                Assert.NotNull(result);
            }
        }
示例#2
0
        public async Task Should_Excute_Cmd_And_Wait_Result()
        {
            using (var client = new TerminalClient(_trace))
            {
                var result = await client.ExcuteAndReadOutputAsync(@"C:\", "cmd.exe", "/c dir");

                Assert.NotNull(result);
            }
        }
示例#3
0
        public async Task Should_Excute_When_No_Cmd()
        {
            using (var client = new TerminalClient())
            {
                var result = await client.ExcuteAndReadOutputAsync(@"C:\", "ipconfig", "/all");


                Assert.NotNull(result);
            }
        }
示例#4
0
        public async Task Should_Set_Env_Variable()
        {
            var value = "Yeah it is work";

            var env = new Dictionary <string, string>()
            {
                ["TestVar"] = value
            };

            using (var client = new TerminalClient(_trace, env))
            {
                var result = await client.ExcuteAndReadOutputAsync(@"C:\", "powershell.exe", "/c echo $Env:TestVar");

                result = result
                         .Replace("\n", "")
                         .Replace("\r", "");

                Assert.Equal(value, result);
            }
        }