示例#1
0
        public void ShouldOutputSingleEscape()
        {
            var test = new TestEmitter();

            var data   = $"{ESC}";
            var buffer = CreateBufferFromString(data, 16);
            var map    = new InputMapper();
            var keys   = new KeysMap(test.Emitter);

            keys.Register(map);

            map.Process(buffer);

            Assert.AreEqual(data.Length, test.Keys.Count);
            Assert.IsTrue(test.Keys[0].Key == ConsoleKey.Escape);
        }
示例#2
0
        public void ShouldParseClumpedClicks()
        {
            var test = new TestEmitter();

            var md = ESC + "[<0;52;1M";
            var mu = ESC + "[<3;52;1m";

            var map = new InputMapper();
            var c   = new ExtendedMouseModeEncoding(test.Emitter);

            c.Register(map);

            // as long as the parser gets the entire sequence, additional chars shouldn't break anything
            var clump = "123" + md + "456" + mu + "789";

            map.Process(CreateBufferFromString(clump, 32));

            Assert.AreEqual(1, test.MouseMoves.Count);  // same coords, should not move
            Assert.AreEqual(1, test.MouseDowns.Count);
            Assert.AreEqual(1, test.MouseUps.Count);
            Assert.AreEqual(1, test.MouseClicks.Count);
            Assert.AreEqual(9, test.Keys.Count);
        }