示例#1
0
        public void Map_Command_Should_Not_Move_Right_When_Key_Right_Arrow_And_End_Of_Line()
        {
            // arrange
            var text = new StringBuilder();

            text.Append("test code");

            var originalLinePosition = Prompt.Standard.Length + text.Length + 1;

            var state = new ConsoleState(new InputHistory())
            {
                Text        = text,
                ColPosition = originalLinePosition,
            };

            var console = new Mock <IConsole>();

            var navigateCommands = new NavigateCommands(console.Object);

            // act
            navigateCommands.MoveCursorRight(state);

            // assert
            Assert.That(state.ColPosition, Is.EqualTo(originalLinePosition));
        }
示例#2
0
        public void Map_Command_Should_Move_Right_When_Key_Right_Arrow()
        {
            // arrange
            var text = new StringBuilder();

            text.Append("test code");

            var state = new ConsoleState(new InputHistory())
            {
                Text        = text,
                ColPosition = 4,
            };

            var console = new Mock <IConsole>();

            var navigateCommands = new NavigateCommands(console.Object);

            // act
            navigateCommands.MoveCursorRight(state);

            // assert
            Assert.That(state.ColPosition, Is.EqualTo(5));
        }