public void ToHexa_UpperCase() { var options = HexaOptions.UpperCase; Assert.Equal("00", HexaConverter.ToHexaString(new byte[] { 0x00 }, options)); Assert.Equal("01", HexaConverter.ToHexaString(new byte[] { 0x01 }, options)); Assert.Equal("02", HexaConverter.ToHexaString(new byte[] { 0x02 }, options)); Assert.Equal("03", HexaConverter.ToHexaString(new byte[] { 0x03 }, options)); Assert.Equal("04", HexaConverter.ToHexaString(new byte[] { 0x04 }, options)); Assert.Equal("05", HexaConverter.ToHexaString(new byte[] { 0x05 }, options)); Assert.Equal("06", HexaConverter.ToHexaString(new byte[] { 0x06 }, options)); Assert.Equal("07", HexaConverter.ToHexaString(new byte[] { 0x07 }, options)); Assert.Equal("08", HexaConverter.ToHexaString(new byte[] { 0x08 }, options)); Assert.Equal("09", HexaConverter.ToHexaString(new byte[] { 0x09 }, options)); Assert.Equal("0A", HexaConverter.ToHexaString(new byte[] { 0x0A }, options)); Assert.Equal("0B", HexaConverter.ToHexaString(new byte[] { 0x0B }, options)); Assert.Equal("0C", HexaConverter.ToHexaString(new byte[] { 0x0C }, options)); Assert.Equal("0D", HexaConverter.ToHexaString(new byte[] { 0x0D }, options)); Assert.Equal("0E", HexaConverter.ToHexaString(new byte[] { 0x0E }, options)); Assert.Equal("0F", HexaConverter.ToHexaString(new byte[] { 0x0F }, options)); Assert.Equal("102F", HexaConverter.ToHexaString(new byte[] { 0x10, 0x2F }, options)); }
public void ToHexa_LowerCase() { var options = HexaOptions.LowerCase; Assert.Equal("00", HexaConverter.ToHexaString(new byte[] { 0x00 }, options)); Assert.Equal("01", HexaConverter.ToHexaString(new byte[] { 0x01 }, options)); Assert.Equal("02", HexaConverter.ToHexaString(new byte[] { 0x02 }, options)); Assert.Equal("03", HexaConverter.ToHexaString(new byte[] { 0x03 }, options)); Assert.Equal("04", HexaConverter.ToHexaString(new byte[] { 0x04 }, options)); Assert.Equal("05", HexaConverter.ToHexaString(new byte[] { 0x05 }, options)); Assert.Equal("06", HexaConverter.ToHexaString(new byte[] { 0x06 }, options)); Assert.Equal("07", HexaConverter.ToHexaString(new byte[] { 0x07 }, options)); Assert.Equal("08", HexaConverter.ToHexaString(new byte[] { 0x08 }, options)); Assert.Equal("09", HexaConverter.ToHexaString(new byte[] { 0x09 }, options)); Assert.Equal("0a", HexaConverter.ToHexaString(new byte[] { 0x0A }, options)); Assert.Equal("0b", HexaConverter.ToHexaString(new byte[] { 0x0B }, options)); Assert.Equal("0c", HexaConverter.ToHexaString(new byte[] { 0x0C }, options)); Assert.Equal("0d", HexaConverter.ToHexaString(new byte[] { 0x0D }, options)); Assert.Equal("0e", HexaConverter.ToHexaString(new byte[] { 0x0E }, options)); Assert.Equal("0f", HexaConverter.ToHexaString(new byte[] { 0x0F }, options)); Assert.Equal("102f", HexaConverter.ToHexaString(new byte[] { 0x10, 0x2F }, options)); }
static void AssertTryFromHexa(string str, byte[] expected) { Assert.True(HexaConverter.TryParseHexaString(str, out var buffer)); Assert.Equal(expected, buffer); }