public void ReadAndHashUntilPosition_WhenPositionAtStart_ReadsAndHashes() { using (var test = new ReadHashTest()) { SignedPackageArchiveIOUtility.ReadAndHashUntilPosition( test.Reader, test.HashAlgorithm, test.Reader.BaseStream.Length); var actualHash = test.GetHash(); Assert.Equal("F+iNsYev1iwW5d6/PmUnzQBrwBK8kLUagQzYDC1RH0M=", actualHash); Assert.Equal(test.Reader.BaseStream.Length, test.Reader.BaseStream.Position); } }
public void ReadAndHashUntilPosition_WhenPositionAtEnd_ReadsAndHashes() { using (var test = new ReadHashTest()) { test.Reader.BaseStream.Seek(offset: 0, origin: SeekOrigin.End); SignedPackageArchiveIOUtility.ReadAndHashUntilPosition( test.Reader, test.HashAlgorithm, test.Reader.BaseStream.Length); var actualHash = test.GetHash(); Assert.Equal("47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=", actualHash); Assert.Equal(test.Reader.BaseStream.Length, test.Reader.BaseStream.Position); } }
public void ReadAndHashUntilPosition_WhenPositionInMiddle_ReadsAndHashes() { using (var test = new ReadHashTest()) { test.Reader.BaseStream.Seek(offset: 2, origin: SeekOrigin.Begin); SignedPackageArchiveIOUtility.ReadAndHashUntilPosition( test.Reader, test.HashAlgorithm, position: 5); var actualHash = test.GetHash(); Assert.Equal("H1KP/SiVY0wXZTfAVdqlwJcbeRVRmZkzeg41VBDY/Zg=", actualHash); Assert.Equal(5, test.Reader.BaseStream.Position); } }