public void TestKeyInfoConverterWellKnownConsoleKey()
        {
            // oem6
            var converter = new ConsoleKeyInfoConverterAttribute();

            object result = converter.Transform(null, "shift+oem6");
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ConsoleKeyInfo));

            var key = (ConsoleKeyInfo)result;

            Assert.AreEqual(key.KeyChar, '}');
            Assert.AreEqual(key.Key, ConsoleKey.Oem6);
            Assert.AreEqual(key.Modifiers, ConsoleModifiers.Shift);
        }
        public void TestKeyInfoConverterSimpleCharLiteralWithModifiers()
        {
            var converter = new ConsoleKeyInfoConverterAttribute();

            object result = converter.Transform(null, "alt+shift+x");
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ConsoleKeyInfo));

            var key = (ConsoleKeyInfo) result;

            Assert.AreEqual(key.KeyChar, 'X');
            Assert.AreEqual(key.Key, ConsoleKey.X);
            Assert.AreEqual(key.Modifiers, ConsoleModifiers.Shift | ConsoleModifiers.Alt);
        }
        public void TestKeyInfoConverterPassThrough()
        {
            // pass through consolekeyinfo
            var converter = new ConsoleKeyInfoConverterAttribute();

            var key = new ConsoleKeyInfo('x', ConsoleKey.X, true, false, false);
            object result = converter.Transform(null, key);

            Assert.AreEqual(key, result);
        }
 public void TestKeyInfoConverterInvalidModifierTypo()
 {
     var converter = new ConsoleKeyInfoConverterAttribute();
     object result = converter.Transform(null, "alt+shuft+x");
 }
 public void TestKeyInfoConverterInvalidModifierInapplicable()
 {
     var converter = new ConsoleKeyInfoConverterAttribute();
     object result = converter.Transform(null, "shift+}");
 }
 public void TestKeyInfoConverterInvalidKey()
 {
     var converter = new ConsoleKeyInfoConverterAttribute();
     object result = converter.Transform(null, "escrape");
 }