public void Char_Between_Inclusive_Value_Equals_Start_Returns_True()
        {
            char start = '1';
            char end   = '5';
            char value = '1';

            Assert.IsTrue(value.Between(start, end, true));
            Assert.IsTrue(value.Between(start, end));
        }
        public void Inclusive_Value_Not_Between_Start_And_End_Returns_False()
        {
            char start = '1';
            char end   = '5';
            char value = '0';

            Assert.IsFalse(value.Between(start, end, true));
            Assert.IsFalse(value.Between(start, end));
        }
        public void Char_Between_Method_Exclusive_Value_Equals_End_Returns_False()
        {
            char start = '1';
            char end   = '5';
            char value = '5';

            Assert.IsFalse(value.Between(start, end, false));
        }
예제 #4
0
        public static byte keyState(char key)
        {
            var ordinal = (int)key;
            var bytes   = keyboardState();

            if (key.Between('0').And('9'))
            {
                return(bytes[ordinal]);
            }
            else if (key.Between('A').And('Z'))
            {
                return(bytes[ordinal]);
            }
            else if (key.Between('a').And('z'))
            {
                return(bytes[ordinal - 32]);
            }
            else
            {
                throw "Character must be between 0-9, A-Z, a-z".Throws();
            }
        }