public void Test_Bitwise_validate_ConvertHexStringToByteArray_Pass() { var buffer = HexConverter.HexToBytes(_uid); var uid = HexConverter.BytesToHex(buffer); Assert.Equal(uid, _uid); }
/// <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)); }
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)); } }
internal static string ReturnTokenHex(uint charId) { return(HexConverter.BytesToHex(charId.ToBytes())); }
/// <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)); }
public void Test_HexConvert_BytesToHex_Fail() { Assert.Throws <ArgumentNullException>(() => HexConverter.BytesToHex(null)); }
public void Test_HexConvert_BytesToHex_Pass() { var result = HexConverter.BytesToHex(_bytes32); Assert.Equal(_hex32, result); }