public void IsHashComputedEventRaised() { HashSlingerCore.MD5Hasher coreTest = new HashSlingerCore.MD5Hasher(); String[] testFiles = { @"C:\Code\HashSlinger\HashSlingerTests\Electrochromic_glass.ogv" }; coreTest.HashComputed += new EventHandler <HashSlingerCore.HasherEventArgs>(coreTest_HashComputed); byte[] hash = coreTest.ComputeFileHash(testFiles, null); Assert.IsTrue(this.hashComputedRaised); }
public void CompareOutputVsStreamControl() { HashSlingerCore.MD5Hasher coreTest = new HashSlingerCore.MD5Hasher(); String[] testFiles = { @"C:\Code\HashSlinger\HashSlingerTests\White_noise.ogg" }; byte[] hash = coreTest.ComputeFileHash(testFiles, null); byte[] controlHash = ComputeMD5StreamHash(testFiles[0]); Assert.AreEqual(BitConverter.ToString(hash), BitConverter.ToString(controlHash)); }
public void IsHashComputedEventRaised() { HashSlingerCore.MD5Hasher coreTest = new HashSlingerCore.MD5Hasher(); String[] testFiles = { @"C:\Code\HashSlinger\HashSlingerTests\Electrochromic_glass.ogv" }; coreTest.HashComputed += new EventHandler<HashSlingerCore.HasherEventArgs>(coreTest_HashComputed); byte[] hash = coreTest.ComputeFileHash(testFiles, null); Assert.IsTrue(this.hashComputedRaised); }
public void AreProgressEventsBeingRaised() { this.progressEventCount = 0; int blockSize = 16384; HashSlingerCore.MD5Hasher coreTest = new HashSlingerCore.MD5Hasher(); String[] testFiles = { @"C:\Code\HashSlinger\HashSlingerTests\NTB-Buchs-Campus_with_national_and_international_flags.jpg" }; coreTest.HashBlockProcessed += new EventHandler<HashSlingerCore.HasherEventArgs>(coreTest_HashBlockProcessed); FileInfo inputInfo = new FileInfo(testFiles[0]); int expectedBlockCount = (int)((inputInfo.Length / blockSize)); if (expectedBlockCount == 0) expectedBlockCount++; if ((inputInfo.Length % blockSize) > 0) expectedBlockCount++; byte[] hash = coreTest.ComputeFileHash(testFiles, blockSize); Assert.AreEqual(expectedBlockCount, this.progressEventCount); }
public void AreProgressEventsBeingRaised() { this.progressEventCount = 0; int blockSize = 16384; HashSlingerCore.MD5Hasher coreTest = new HashSlingerCore.MD5Hasher(); String[] testFiles = { @"C:\Code\HashSlinger\HashSlingerTests\NTB-Buchs-Campus_with_national_and_international_flags.jpg" }; coreTest.HashBlockProcessed += new EventHandler <HashSlingerCore.HasherEventArgs>(coreTest_HashBlockProcessed); FileInfo inputInfo = new FileInfo(testFiles[0]); int expectedBlockCount = (int)((inputInfo.Length / blockSize)); if (expectedBlockCount == 0) { expectedBlockCount++; } if ((inputInfo.Length % blockSize) > 0) { expectedBlockCount++; } byte[] hash = coreTest.ComputeFileHash(testFiles, blockSize); Assert.AreEqual(expectedBlockCount, this.progressEventCount); }