Пример #1
0
        private void ValidateOutput(ExecutionOutput output, IEnumerable <string> expectedStdOut, bool failOnStdErr = true)
        {
            Assert.IsTrue(output.StdOut.Contains("JSTest: Version " + BaseFrameworkTest.packageVersion), "Console header version should match package version.");

            if (output.ProcessTimeout)
            {
                Assert.Fail("Process timed out");
            }

            if (!string.IsNullOrEmpty(output.StdErr.Trim().ToString()) && failOnStdErr)
            {
                Assert.Fail("StdErr for execution should have been empty. Value: {0}", output.StdErr);
            }

            var stdout = output.StdOut;

            foreach (var str in this.PreDefinedOutput)
            {
                Assert.IsTrue(stdout.Contains(str), "Actual StdOut did not match the expected StdOut. \n\n Did not contain: {0} \n\n {1}", str, stdout);
            }

            foreach (var str in expectedStdOut)
            {
                Assert.IsTrue(stdout.Contains(str), "Actual StdOut did not match the expected StdOut. \n\n Did not contain: {0} \n\n {1}", str, stdout);
            }

            Console.Write(stdout);
        }
Пример #2
0
        private void ValidateOutput(ExecutionOutput output, IEnumerable <string> expectedStdOut, IEnumerable <string> expectedStdErr)
        {
            this.ValidateOutput(output, expectedStdOut, false);

            var stderr = output.StdErr;

            foreach (var str in expectedStdErr)
            {
                Assert.IsTrue(stderr.Contains(str), "Actual StdErr did not match the StdErr. \n\n Did not contain: {0} \n\n {1}", str, stderr);
            }

            Console.Write(stderr);
        }
Пример #3
0
        private void ValidateOutput(ExecutionOutput output, IEnumerable <string> expectedStdOut, bool failOnStdErr = true)
        {
            if (output.ProcessTimeout)
            {
                Assert.Fail("Process timed out");
            }

            if (!string.IsNullOrEmpty(output.StdErr.Trim().ToString()) && failOnStdErr)
            {
                Assert.Fail("StandardError for execution should have been empty");
            }

            var stdout = output.StdOut;

            foreach (var str in expectedStdOut)
            {
                Assert.IsTrue(stdout.Contains(str), "Actual StdOut did not match the expected StdOut");
            }

            Console.Write(stdout);
        }