public void CanCreateASelectPenInstance()
        {
            // Arrange and Act
            var turtleGraphicsAttribute = new TurtleGraphicsAttribute();
            var turtleGraphicsArgumentAttribute = new List<TurtleGraphicsArgumentAttribute>();
            var argumentValues = new List<string>();

            var turtleGraphicsCommand = new TurtleGraphicsCommand
                                            {
                                                CommandText = GlobalConstants.SelectPenCommandText,
                                                Attribute = turtleGraphicsAttribute,
                                                ArgumentAttributes = turtleGraphicsArgumentAttribute,
                                                ArgumentValues = argumentValues,
                                                Status = TurtleGraphicsCommandStatus.Valid
                                            };

            // Assert
            Assert.AreEqual(GlobalConstants.SelectPenCommandText, turtleGraphicsCommand.CommandText);
            Assert.AreEqual(turtleGraphicsAttribute, turtleGraphicsCommand.Attribute);
            Assert.AreEqual(argumentValues, turtleGraphicsCommand.ArgumentValues);
            Assert.AreEqual(turtleGraphicsArgumentAttribute, turtleGraphicsCommand.ArgumentAttributes);
            Assert.AreEqual(TurtleGraphicsCommandStatus.Valid, turtleGraphicsCommand.Status);
        }
        private static void CanExecuteCommand(List<string> args, ITurtleGraphicsCommands
            turtleGraphicsSystemMock, TurtleGraphicsAttribute turtleGraphicsAttribute,
            List<TurtleGraphicsArgumentAttribute> argumentAttributes, string implementingFunctionName)
        {
            // Arrange
            var tokens = new List<string> { turtleGraphicsAttribute.CommandText};

            if (args != null)
            {
                tokens.AddRange(args);
            }

            var textParserMock = GetTextParserMock(tokens);

            var turtleGraphicsCommand = new TurtleGraphicsCommand
            {
                Attribute = turtleGraphicsAttribute,
                ArgumentAttributes = argumentAttributes,
                CommandText = turtleGraphicsAttribute.CommandText,
                ArgumentValues = args,
                Status = TurtleGraphicsCommandStatus.Valid,
                ExecutionContext = turtleGraphicsSystemMock,
                ImplementingFunctionName = implementingFunctionName,
            };

            var turtleGraphicsSyntaxAnalyser = GetSyntaxAnalyserMock(turtleGraphicsCommand);

            var commandProcessor = GetExecutionEngineInstance(textParserMock, turtleGraphicsSyntaxAnalyser);

            var commandLine = turtleGraphicsAttribute.CommandText + " ";

            if (args != null)
            {
                foreach (var arg in args)
                {
                    commandLine += arg;
                    commandLine += " ";
                }
            }

            // Act
            var turtleGraphicsCommandReturned = commandProcessor.ExecuteCommandLine(commandLine, false, true);

            // Assert
            textParserMock.VerifyAllExpectations();
            turtleGraphicsSystemMock.VerifyAllExpectations();
            turtleGraphicsSyntaxAnalyser.VerifyAllExpectations();
            Assert.AreEqual(TurtleGraphicsCommandStatus.Valid, turtleGraphicsCommandReturned[0].Status);
        }
        private static List<TurtleGraphicsCommand> CanExecuteCommand(List<string> args, ITurtleGraphicsControlStructures
            turtleGraphicsControlStructuresMock, TurtleGraphicsAttribute turtleGraphicsAttribute,
            List<TurtleGraphicsArgumentAttribute> argumentAttributes, TurtleGraphicsCommand turtleGraphicsCommand,
            string implementingFunctionName, ExecutionEngineStatusChangedEventHandler stateChangedHandler = null,
            bool hasCompletedWithoutErrors = true)
        {
            // Arrange
            var tokens = new List<string> { turtleGraphicsAttribute.CommandText};

            if (args != null)
            {
                tokens.AddRange(args);
            }

            var textParserMock = GetTextParserMock(tokens);

            turtleGraphicsCommand.Attribute = turtleGraphicsAttribute;
            turtleGraphicsCommand.ArgumentAttributes = argumentAttributes;
            turtleGraphicsCommand.CommandText = turtleGraphicsAttribute.CommandText;
            turtleGraphicsCommand.ArgumentValues = args;
            turtleGraphicsCommand.Status = TurtleGraphicsCommandStatus.Valid;
            turtleGraphicsCommand.ExecutionContext = turtleGraphicsControlStructuresMock;
            turtleGraphicsCommand.ImplementingFunctionName = implementingFunctionName;

            var turtleGraphicsSyntaxAnalyser = GetSyntaxAnalyserMock(turtleGraphicsCommand);
            var executionEngine = GetExecutionEngineInstance(textParserMock, turtleGraphicsSyntaxAnalyser);

            if (stateChangedHandler != null)
            {
                executionEngine.StatusChanged += stateChangedHandler;
            }

            var commandLine = turtleGraphicsAttribute.CommandText + " ";

            if (args != null)
            {
                foreach (var arg in args)
                {
                    commandLine += arg;
                    commandLine += " ";
                }
            }

            // Act
            var turtleGraphicsCommandReturned = executionEngine.ExecuteCommandLine(commandLine, false, true);

            // Assert
            textParserMock.VerifyAllExpectations();
            turtleGraphicsControlStructuresMock.VerifyAllExpectations();
            Assert.AreEqual(hasCompletedWithoutErrors, executionEngine.HasExecutedWithoutErrors());

            return turtleGraphicsCommandReturned;
        }