Exemplo n.º 1
0
        public void Goto_WithNonExistingLineNumber_ThrowsArgumentOutOfRangeException()
        {
            var          runner            = new ProgramRunner(lines);
            const string nonExistingNumber = "200";

            runner.Goto(nonExistingNumber);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }