Exemple #1
0
        public void ComputeChecksum_Exception_Value_Null()
        {
            byte[] bytes = null;
            var    crc   = new CRC16_ANSI();

            Assert.Throws <ArgumentNullException>(() => crc.ComputeChecksum(bytes));
        }
Exemple #2
0
        public void ComputeChecksum_String_Valid(string value, ushort expected)
        {
            var crc    = new CRC16_ANSI();
            var result = crc.ComputeChecksum(value);

            Assert.Equal(expected, result);
        }
Exemple #3
0
        public void ComputeChecksum_Bytes_Valid(string value, ushort expected)
        {
            var bytes  = Encoding.ASCII.GetBytes(value);
            var crc    = new CRC16_ANSI();
            var result = crc.ComputeChecksum(bytes);

            Assert.Equal(expected, result);
        }
Exemple #4
0
        public void ComputeChecksum_Exception_Value_Empty()
        {
            var crc = new CRC16_ANSI();

            Assert.Throws <ArgumentNullException>(() => crc.ComputeChecksum(new byte[] { }));
        }