public void CreateHash_StreamSmallerThan64k_ReturnsEmptyHash( [Frozen] IHashCalculator hashProvider, FileHasher sut) { var expectedHash = new byte[0]; var data = new byte[0]; using (var stream = new MemoryStream(data)) { var result = sut.CreateHash(stream); Assert.That(result, Is.EquivalentTo(expectedHash)); } }
public void CreateHash_128kStream_ReturnsHashFromHashAlgo( byte[] expectedHash, [Frozen]IHashCalculator hashProvider, FileHasher sut) { var data = CreateData(); A.CallTo(() => hashProvider.ComputeHash( A<byte[]>.That.IsSameSequenceAs(data))) .Returns(expectedHash); using (var stream = new MemoryStream(data)) { var result = sut.CreateHash(stream); Assert.That(result, Is.EquivalentTo(expectedHash)); } }
public SubDbFileHasher() { _hasher = new FileHasher(new HashCalculator<MD5CryptoServiceProvider>()); }
public OpenSubtitlesFileHasher() { _hasher = new FileHasher(new OpenSubtitlesHashCalculator()); }