Exemple #1
0
        public void MoveNext_WhenRecallAfterComplete_ThrowsInvalidOperationException()
        {
            var runner = new ProgramRunner(lines);

            runner.Complete();
            runner.MoveNext();
            runner.MoveNext();
        }
Exemple #2
0
        public void MoveNext_BeyondTheEndOfProgram_ThrowsInvalidOperationException()
        {
            var runner = new ProgramRunner(lines);

            while (runner.MoveNext())
            {
                ;
            }

            runner.MoveNext();
        }
Exemple #3
0
        public void MoveNext_AfterConstructorCall_ReturnsTrue()
        {
            var runner = new ProgramRunner(lines);

            var condition = runner.MoveNext();

            Assert.IsTrue(condition);
        }
Exemple #4
0
        public void RunningLine_AfterMoveNext_RetursFirstLine()
        {
            var runner    = new ProgramRunner(lines);
            var condition = runner.MoveNext();

            var statement = runner.RunningLine.Statement;

            Assert.IsInstanceOfType(statement, typeof(Rem));
        }
Exemple #5
0
        public void MoveNext_AfterComplete_ReturnsFalse()
        {
            var runner = new ProgramRunner(lines);

            runner.Complete();

            var condition = runner.MoveNext();

            Assert.IsFalse(condition);
        }
Exemple #6
0
        public void MoveNext_AfterGoto_ReturnsTrue()
        {
            var          runner         = new ProgramRunner(lines);
            const string existingNumber = "30";

            runner.Goto(existingNumber);

            var condition = runner.MoveNext();

            Assert.IsTrue(condition);
        }
Exemple #7
0
        public void MoveNext_AfterGoto_KeepsCurrentStatement()
        {
            var          runner         = new ProgramRunner(lines);
            const string existingNumber = "30";

            runner.Goto(existingNumber);

            var expected  = runner.RunningLine;
            var condition = runner.MoveNext();
            var actual    = runner.RunningLine;

            Assert.AreEqual(expected, actual);
        }