Beispiel #1
0
        public void TestMethod_HexStringToByteArray_false_not_even_length()
        {
            string source = "01020";

            byte[] expected = { 0x01, 0x02 };
            byte[] result   = StringFunc.HexStringToByteArray(source);
            Assert.AreNotEqual(result, expected);
        }
Beispiel #2
0
        public void TestMethod_HexStringToByteArray_false()
        {
            string source = "010203091011121314151617";

            byte[] expected = { 0x01 };
            byte[] result   = StringFunc.HexStringToByteArray(source);
            Assert.AreNotEqual(result, expected);
        }
Beispiel #3
0
        public void TestMethod_HexStringToByteArray_true_two_values()
        {
            string source = "0102";

            byte[] expected = { 0x01, 0x02 };
            byte[] result   = StringFunc.HexStringToByteArray(source);
            Assert.IsTrue(result[0] == expected[0]);
            Assert.IsTrue(result[1] == expected[1]);
        }
Beispiel #4
0
        public void TestMethod_HexStringToByteArray_true()
        {
            string source = "010203091011121314151617";

            byte[] expected = { 0x01, 0x02, 0x03, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 };
            byte[] result   = StringFunc.HexStringToByteArray(source);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.IsTrue(result[i] == expected[i]);
            }
        }