/// <summary> /// /// </summary> /// <param name="ex"></param> private void impl(string ex, string result) { //string s = "0123456789" + ex; string s = ex; byte[] bs = new byte[s.Length]; for (int i = 0; i < s.Length; i++) { bs[i] = BitConverter.GetBytes(s[i])[0]; } HZ.CRC.AsciiSum crc = new HZ.CRC.AsciiSum(); byte[] bscrc = crc.Calc(bs, 0, s.Length); Assert.AreEqual((byte)result[0], bscrc[0]); Assert.AreEqual((byte)result[1], bscrc[1]); Assert.AreEqual((byte)result[2], bscrc[2]); }