Exemple #1
0
        public void Goto_WithNonExistingLineNumber_ThrowsArgumentOutOfRangeException()
        {
            var          runner            = new ProgramRunner(lines);
            const string nonExistingNumber = "200";

            runner.Goto(nonExistingNumber);
        }
Exemple #2
0
        public void MoveNext_AfterConstructorCall_ReturnsTrue()
        {
            var runner = new ProgramRunner(lines);

            var condition = runner.MoveNext();

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

            runner.Break();

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

            runner.Complete();
            runner.MoveNext();
            runner.MoveNext();
        }
Exemple #5
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 #6
0
        public void MoveNext_AfterComplete_ReturnsFalse()
        {
            var runner = new ProgramRunner(lines);

            runner.Complete();

            var condition = runner.MoveNext();

            Assert.IsFalse(condition);
        }
Exemple #7
0
        public void Goto_WithExistingLineNumber_SetsCurrentStatement()
        {
            var          runner = new ProgramRunner(lines);
            const string existingNumberWithRemStatement = "100";

            runner.Goto(existingNumberWithRemStatement);
            var actual = (runner.RunningLine.Statement as Rem).Comment;

            Assert.AreEqual("The end", actual);
        }
Exemple #8
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 #9
0
        public void MoveNext_BeyondTheEndOfProgram_ThrowsInvalidOperationException()
        {
            var runner = new ProgramRunner(lines);

            while (runner.MoveNext())
            {
                ;
            }

            runner.MoveNext();
        }
Exemple #10
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);
        }
Exemple #11
0
        public void RunningLine_AfterConstructorCall_ThrowsIndexOutOfRangeException()
        {
            var runner = new ProgramRunner(lines);

            var statement = runner.RunningLine;
        }
Exemple #12
0
        public void IsBroke_AfterConstructorCall_IsFalse()
        {
            var runner = new ProgramRunner(lines);

            Assert.IsFalse(runner.IsBroke);
        }
Exemple #13
0
 public void ProgramRunner_WithNull_ThrowsArgumentNullException()
 {
     var runner = new ProgramRunner(null);
 }
Exemple #14
0
 protected virtual internal void StartRun()
 {
     Runner = new ProgramRunner(Lines);
 }