Beispiel #1
0
        public void BadBinary()
        {
            //Proc throws exceptions where as the observable does not.
            var    writer      = new TestConsoleOutWriter();
            Action call        = () => Proc.Start("this-does-not-exist.exe");
            var    shouldThrow = call.ShouldThrow <ObservableProcessException>();

            shouldThrow.And.InnerException.Message.Should().NotBeEmpty();
            shouldThrow.And.Message.Should().Contain("this-does-not-exist.exe");
        }
Beispiel #2
0
        public void ReadKeyFirst()
        {
            var args   = TestCaseArguments(nameof(ReadKeyFirst));
            var writer = new TestConsoleOutWriter();
            var result = Proc.Start(args, WaitTimeout, writer, s => s.Write("y"));

            result.Completed.Should().BeTrue("completed");
            result.ExitCode.Should().HaveValue();
            result.ConsoleOut.Should().NotBeEmpty();
            writer.Out.Should().NotBeEmpty();
        }
        public void ConsoleWriterSeesAllLines()
        {
            var writer = new TestConsoleOutWriter();
            var args   = TestCaseArguments("TrailingLines");
            var result = Proc.Start(args, WaitTimeout, writer);
            var lines  = writer.Lines;

            lines.Should().NotBeEmpty().And.HaveCount(_expectedLines.Length);
            for (var i = 0; i < lines.Length; i++)
            {
                lines[i].Should().Be(_expectedLines[i], i.ToString());
            }
        }
Beispiel #4
0
        public void ConsoleWriterSeesAllLines()
        {
            var writer = new TestConsoleOutWriter();
            var args   = TestCaseArguments("MoreText");
            var result = Proc.Start(args, WaitTimeout, writer);

            result.ExitCode.Should().HaveValue();
            result.Completed.Should().BeTrue();
            var lines = writer.Lines;

            lines.Should().NotBeEmpty().And.HaveCount(_expectedLines.Length + 1);
            for (var i = 0; i < lines.Length - 1; i++)
            {
                lines[i].Should().Be(_expectedLines[i], i.ToString());
            }
        }