Esempio n. 1
0
        public void ExternalTool_ConsumingResultWithStandardErrorOutput_ThrowsException()
        {
            const string canary = "6h4sb6455t";

            // Just echo something to stderr.
            Assert.ThrowsException <EnvironmentException>(() => ExternalTool.Execute(TestData.CommandHandler, TestData.MakeCommandString(string.Format("echo {0} 1>&2", canary)), ExecuteTimeout));
        }
Esempio n. 2
0
        public void ExternalTool_ConsumingResultWithNonSuccessfulExitCode_ThrowsException()
        {
            const string canary = "fgujw456hnt";

            // Nonsense command, should result in error.
            Assert.ThrowsException <EnvironmentException>(() => ExternalTool.Execute(TestData.CommandHandler, TestData.MakeCommandString(canary), ExecuteTimeout));
        }
Esempio n. 3
0
        public void ExternalTool_StandardOutputIsCaptured()
        {
            const string canary = "146adgha4";
            var          result = ExternalTool.Execute(TestData.CommandHandler, TestData.MakeCommandString(string.Format("echo {0}", canary)), ExecuteTimeout);

            Assert.AreEqual(0, result.ExitCode);
            Assert.IsTrue(result.StandardOutput.Contains(canary));
        }
Esempio n. 4
0
        public void ExternalTool_StandardErrorIsInExceptionMessage()
        {
            const string canary = "jtd78d56rereee";

            // Nonsense command, should result in error.
            var ex = Assert.ThrowsException <EnvironmentException>(() => ExternalTool.Execute(TestData.CommandHandler, TestData.MakeCommandString(canary), ExecuteTimeout));

            Assert.IsTrue(ex.Message.Contains(canary));
        }
Esempio n. 5
0
 public void ExternalTool_ConsumingResultWithFailureExitCode_ThrowsException()
 {
     Assert.ThrowsException <EnvironmentException>(() => ExternalTool.Execute(TestData.CommandHandler, TestData.MakeCommandString("exit 1"), ExecuteTimeout));
 }