示例#1
0
        public void GetByteCountTest()
        {
            // Arrange
            var expected = 2;

            // Act
            var actual = HexEncoding.GetByteCount("FFA4");

            // Assert
            Assert.Equal(expected, actual);
        }
        public void GetByteCountWithValidHexStringTest()
        {
            string[] hexString = new string[5] {
                "", "a", "00", "011", "013235"
            };
            int[] expected = new int[5] {
                0, 0, 1, 1, 3
            };

            for (int c = 0; c < hexString.Length; c++)
            {
                int actual = HexEncoding.GetByteCount(hexString[c]);
                Assert.AreEqual(expected[c], actual, "The hexString : " + hexString[c] + " should give a ByteCount of : " + expected[c]);
            }
        }