ToHexCharArray() публичный статический Метод

public static ToHexCharArray ( byte bytes ) : char[]
bytes byte
Результат char[]
Пример #1
0
        public void TestToHexCharArray()
        {
            var bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };

            var expectedChars = new[]
            {
                '0', '0', '0', '1', '0', '2', '0', '3',
                '0', '4', '0', '5', '0', '6', '0', '7',
                '0', '8', '0', '9', '0', 'A', '0', 'B',
                '0', 'C', '0', 'D', '0', 'E', '0', 'F'
            };
            var actualChars = Hex.ToHexCharArray(bytes);

            Assert.NotNull(actualChars);
            Assert.AreEqual(expectedChars.Length, actualChars.Length);

            for (var i = 0; i < expectedChars.Length; ++i)
            {
                Assert.AreEqual(expectedChars[i], actualChars[i]);
            }
        }