Пример #1
0
        private static void RunTestComputeCrcSplit(string input1, string input2, string input3, string input4, long expected)
        {
            var bytes1 = StringToBytesConverter.ConvertToByteArray(input1);
            var bytes2 = StringToBytesConverter.ConvertToByteArray(input2);
            var bytes3 = StringToBytesConverter.ConvertToByteArray(input3);
            var bytes4 = StringToBytesConverter.ConvertToByteArray(input4);

            var crc = Crc24Computer.ComputeCrc(bytes1);

            crc = Crc24Computer.ComputeCrc(bytes2, crc);
            crc = Crc24Computer.ComputeCrc(bytes3, crc);
            crc = Crc24Computer.ComputeCrc(bytes4, crc);

            crc.ShouldBe(expected);
        }
Пример #2
0
        private static void RunTestComputeCrcTextStrings(string input, long expected)
        {
            var bytes = System.Text.Encoding.ASCII.GetBytes(input);

            Crc24Computer.ComputeCrc(bytes).ShouldBe(expected);
        }
Пример #3
0
 public void ComputeCrcShouldReturn0ForEmptyInput()
 {
     Crc24Computer.ComputeCrc(new byte[0]).ShouldBe(0);
 }
Пример #4
0
        private static void TestComputeCrc(string input, long expected)
        {
            var bytes = StringToBytesConverter.ConvertToByteArray(input);

            Crc24Computer.ComputeCrc(bytes).ShouldBe(expected);
        }
Пример #5
0
 public void ComputeCrcShouldThrowExceptionIfInputIsNull()
 {
     Crc24Computer.ComputeCrc(null);
 }