Created
February 27, 2015 17:15
-
-
Save jltrem/56c32209c616c6a1e1b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact] | |
public void test_byte_encoding_decoding() | |
{ | |
var encoding = new UTF8Encoding(); | |
byte[] inputBytes = encoding.GetBytes("sample"); | |
var hexString = BitConverter.ToString(inputBytes); | |
byte[] outputBytes = hexString.Split('-').Select(hex => byte.Parse(hex, NumberStyles.HexNumber)).ToArray(); | |
Assert.Equal(inputBytes, outputBytes); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment