public static void hex_to_binary_conversion() { "Pairs of digits equate to a single byte".Is(() => { const string hex = "0123456789ABCDEF"; var binary = Decrypter.FromHex(hex); Assert.True(binary.SequenceEqual(new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF })); }); "Non-hex digits generate an exception".Is(() => { const string hex = "ZZ"; Assert.Throws(() => Decrypter.FromHex(hex)); }); "The hex stream must have an even number of digits".Is(() => { const string hex = "F"; Assert.Throws(() => Decrypter.FromHex(hex)); }); }