示例#1
0
        public void InputFieldBufferTests()
        {
            WindowManager manager      = new WindowManager(ConsoleColor.White, ConsoleColor.Red);
            InputField    letterBuffer = manager.CreateInputField(TESTBUFFER, new CursorPosition(20, 20), 20, InputType.StringNoNumbersNoSpecialCharacters, false);

            letterBuffer.SetBuffer("abcdefghiljklmnopqrs");
            Assert.True(letterBuffer.ValidateField());
            Assert.Greater(letterBuffer.BufferLength, 10);
            letterBuffer.AddCharToBuffer('t');
            Assert.True(letterBuffer.ValidateField());
            letterBuffer.EmptyBuffer(false);
            Assert.False(letterBuffer.ValidateField());
            letterBuffer.SetBuffer("abcde");
            Assert.AreEqual(5, letterBuffer.BufferLength);
            Assert.True(letterBuffer.DeleteChar());
            Assert.AreEqual(4, letterBuffer.BufferLength);
            Assert.True(letterBuffer.ValidateField());
            letterBuffer.AddCharToBuffer('l');
            Assert.AreEqual(5, letterBuffer.BufferLength);
            Assert.True(letterBuffer.DeleteChar());
        }