예제 #1
0
        public void Test_Bitwise_validate_ConvertHexStringToByteArray_Pass()
        {
            var buffer = HexConverter.HexToBytes(_uid);
            var uid    = HexConverter.BytesToHex(buffer);

            Assert.Equal(uid, _uid);
        }
예제 #2
0
 /// <summary>
 /// Returns the raw bytes as hex.
 /// </summary>
 /// <param name="upper">True if the results should be upper case. Default is true.</param>
 /// <param name="delimiter">The delimiter between hex bytes. Default is null.</param>
 /// <returns>The hex string.</returns>
 public string AsHex(bool upper = true, char?delimiter = null)
 {
     if (ResultingBytes == null)
     {
         return(null);
     }
     return(HexConverter.BytesToHex(ResultingBytes, delimiter, upper));
 }
예제 #3
0
 public void TestBytesToHex(string inputBase64, char?delimiter, bool upperCase, string expected)
 {
     if (inputBase64 == null)
     {
         Assert.IsNull(HexConverter.BytesToHex(null));
     }
     else
     {
         Assert.AreEqual(expected, HexConverter.BytesToHex(Convert.FromBase64String(inputBase64), delimiter, upperCase));
     }
 }
예제 #4
0
 internal static string ReturnTokenHex(uint charId)
 {
     return(HexConverter.BytesToHex(charId.ToBytes()));
 }
예제 #5
0
 /// <summary>
 /// Converts the byte array into a hexadecimal string
 /// </summary>
 /// <param name="bytes"></param>
 /// <returns>hexadecimal string</returns>
 public static string ToHex(this byte[] bytes)
 {
     return(HexConverter.BytesToHex(bytes));
 }
예제 #6
0
 public void Test_HexConvert_BytesToHex_Fail()
 {
     Assert.Throws <ArgumentNullException>(() => HexConverter.BytesToHex(null));
 }
예제 #7
0
        public void Test_HexConvert_BytesToHex_Pass()
        {
            var result = HexConverter.BytesToHex(_bytes32);

            Assert.Equal(_hex32, result);
        }