Example #1
0
        public void Test_Bitwise_validate_Hex_PassFail()
        {
            const string hexValid    = "A";
            const string hexValid2   = "FF";
            const string hexInvalid  = "0Z";
            const string hexInvalid2 = "AG";

            Assert.True(HexConverter.ContainsOnlyHexNibbles(_char_page35));
            Assert.True(HexConverter.ContainsOnlyHexNibbles(_char_page36));
            Assert.True(HexConverter.ContainsOnlyHexNibbles(_uid));
            Assert.True(HexConverter.ContainsOnlyHexNibbles(hexValid));
            Assert.True(HexConverter.ContainsOnlyHexNibbles(hexValid2));
            Assert.True(HexConverter.ContainsOnlyHexNibbles(_uid + hexValid));

            Assert.False(HexConverter.ContainsOnlyHexNibbles(hexInvalid));
            Assert.False(HexConverter.ContainsOnlyHexNibbles(hexInvalid2));
            Assert.False(HexConverter.ContainsOnlyHexNibbles(_uid + hexInvalid));
            Assert.False(HexConverter.ContainsOnlyHexNibbles(_char_page35 + hexInvalid2));
        }
Example #2
0
 public void Test_HexConvert_Nibble_Fail(string hex)
 {
     Assert.False(HexConverter.ContainsOnlyHexNibbles(hex));
 }
Example #3
0
 /// <summary>
 /// Determins if the input string contains only hexadecimal nibbles
 /// </summary>
 /// <param name="input">input string to check for hex</param>
 /// <returns>true if all characters in string are valid hex nibbles</returns>
 public static bool HasValidHexChars(this string input)
 {
     return(HexConverter.ContainsOnlyHexNibbles(input));
 }
Example #4
0
 public void Test_HexConvert_Nibble_Pass(string hex)
 {
     Assert.True(HexConverter.ContainsOnlyHexNibbles(hex));
 }