public void Autosar_ItCalculates() { byte[] testData = Encoding.ASCII.GetBytes("123456789"); byte expected = 0x4B; byte given = CrcAutosar.Calculate(testData); Assert.AreEqual(expected, given); }
public void Autosar_ItChecks() { byte[] testData = Encoding.ASCII.GetBytes("123456789"); byte[] crc = { 0x4b }; byte[] input = new byte[testData.Length + crc.Length]; Buffer.BlockCopy(testData, 0, input, 0, testData.Length); Buffer.BlockCopy(crc, 0, input, testData.Length, crc.Length); bool given = CrcAutosar.Check(input); Assert.IsTrue(given); }