예제 #1
0
        public void MatchesCodeInRangeTrue()
        {
            var start = GetHexBytes('0', 'A');
            var end   = GetHexBytes('8', '0');

            var codespace = new CodespaceRange(start, end);

            var matches = codespace.Matches(GetHexBytes('5', 'A'));

            Assert.True(matches);
        }
예제 #2
0
        public void MatchesCodeWrongLengthFalse()
        {
            var start = GetHexBytes('0', 'A');
            var end   = GetHexBytes('8', '0');

            var codespace = new CodespaceRange(start, end);

            var matches = codespace.Matches(GetHexBytes('6', '9', '0', '1'));

            Assert.False(matches);
        }
예제 #3
0
        public void MatchesCodeHigherThanEndFalse()
        {
            var start = GetHexBytes('0', 'A');
            var end   = GetHexBytes('8', '0');

            var codespace = new CodespaceRange(start, end);

            var matches = codespace.Matches(GetHexBytes('9', '6'));

            Assert.False(matches);
        }
예제 #4
0
        public void MatchesCodeIsNullThrows()
        {
            var start = GetHexBytes('0', 'A');
            var end   = GetHexBytes('8', '0');

            var codespace = new CodespaceRange(start, end);

            Action action = () => codespace.Matches(null);

            Assert.Throws <ArgumentNullException>(action);
        }