Пример #1
0
        protected void StartAndWaitForCompletion()
        {
            PDP.Continue(waitForHalt: false);

            var sw = new Stopwatch();

            sw.Start();

            var done    = false;
            var failed  = false;
            var timeout = false;

            while (!timeout && !done && !failed && PDP.Running)
            {
                done = ExpectedOutput.Any() && ExpectedOutput.All(x => PDP.Processor.Teleprinter.Printout.Contains(x));

                failed = UnexpectedOutput.Any(x => PDP.Processor.Teleprinter.Printout.Contains(x));

                timeout = sw.Elapsed > MaxRunningTime;

                Thread.Sleep(200);
            }

            if (!ExpectHLT)
            {
                Assert.IsTrue(PDP.Running);
            }

            PDP.Halt();

            Assert.IsFalse(failed);

            if (!ExpectedOutput.Any())
            {
                Assert.IsFalse(done);
                Assert.IsTrue(timeout);
            }
            else
            {
                Assert.IsTrue(done);
                Assert.IsFalse(timeout);
            }

            PDP.Halt();
        }