public void Crc32Checksum_4() { if (ZLibInit.ZLibProvided) { Crc32Checksum crc = new Crc32Checksum(); crc.Append(Encoding.UTF8.GetBytes("ABC")); Assert.IsTrue(crc.Checksum == 0xA3830348); // ABC crc.Append(Encoding.UTF8.GetBytes("DEF")); Assert.IsTrue(crc.Checksum == 0xBB76FE69); // ABCDEF } }
public void Crc32Checksum_1() { void Template(string path, uint checksum) { string filePath = Path.Combine(TestSetup.SampleDir, path); using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { Crc32Checksum crc = new Crc32Checksum(); crc.Append(fs); Assert.IsTrue(crc.Checksum == checksum); } } if (!ZLibInit.ZLibProvided) { return; } Template("ex1.jpg", 0x1961D0C6); Template("ex2.jpg", 0x7641A243); Template("ex3.jpg", 0x63D4D64B); }