Esempio n. 1
0
        public void TestMethod_ByteArrayToHexString_false()
        {
            byte[]       source   = { 0x01, 0x02, 0x03, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 };
            const string expected = "01";
            string       result   = StringFunc.ByteArrayToString(source);

            Assert.AreNotEqual(result, expected);
        }
Esempio n. 2
0
        public void TestMethod_ByteArrayToString_true_one()
        {
            byte[]       source   = { 0x01 };
            const string expected = "01";
            string       result   = StringFunc.ByteArrayToString(source);

            Assert.AreEqual(result, expected);
        }
Esempio n. 3
0
        public void TestMethod_ByteArrayToHexString_true()
        {
            byte[]       source   = { 0x01, 0x02, 0x03, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 };
            const string expected = "010203091011121314151617";
            string       result   = StringFunc.ByteArrayToString(source);

            Assert.AreEqual(result, expected);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        public void TestMethod_HexStringToByteArray_false()
        {
            string source = "010203091011121314151617";

            byte[] expected = { 0x01 };
            byte[] result   = StringFunc.HexStringToByteArray(source);
            Assert.AreNotEqual(result, expected);
        }
        public void TestMethod_NumberOfOccurrences_long_2()
        {
            const string source1  = "long";
            const string source2  = "a long long time ago in a galaxy far far away";
            const int    expected = 2;
            int          result   = StringFunc.NumberOfOccurrences(source1, source2);

            Assert.AreEqual(result, expected);
        }
        public void TestMethod_NumberOfOccurrences_1()
        {
            const string source1  = "One";
            const string source2  = "OneTwoThreeTwo";
            const int    expected = 1;
            int          result   = StringFunc.NumberOfOccurrences(source1, source2);

            Assert.AreEqual(result, expected);
        }
        public void TestMethod_NumberOfOccurrences_numbers()
        {
            const string source1  = "6";
            const string source2  = "123456789OneTwoThreeFourFive";
            const int    expected = 1;
            int          result   = StringFunc.NumberOfOccurrences(source1, source2);

            Assert.AreEqual(result, expected);
        }
        public void TestMethod_NumberOfOccurrences_3_with_upper_and_lower_case()
        {
            const string source1  = "One";
            const string source2  = "oneTwoOneThreeTwoone";
            const int    expected = 3;
            int          result   = StringFunc.NumberOfOccurrences(source1, source2);

            Assert.AreEqual(result, expected);
        }
        public void TestMethod_NumberOfOccurrences_brown_fox_z_1()
        {
            const string source1  = "z";
            const string source2  = "The quick brown fox jumps over the lazy dog";
            const int    expected = 1;
            int          result   = StringFunc.NumberOfOccurrences(source1, source2);

            Assert.AreEqual(result, expected);
        }
Esempio n. 11
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]);
        }
Esempio n. 12
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]);
            }
        }