Пример #1
0
        public void Sha256Hash_GetHash_Null_3()
        {
            IHash hashAlgo = new Sha256Hash();

            Action action = () => hashAlgo.GetHash(null as FileInfo);

            action.Should().Throw <ArgumentNullException>();
        }
Пример #2
0
        public void Sha256Hash_GetHash_Empty()
        {
            IHash hashAlgo = new Sha256Hash();

            Action action = () => hashAlgo.GetHash(string.Empty);

            action.Should().Throw <ArgumentNullException>();
        }
Пример #3
0
        public void Sha256Hash_GetHash_Valid_2()
        {
            IHash hashAlgo = new Sha256Hash();

            HashResult hashResult = hashAlgo.GetHash(Data.ExpectedHashFilePath);

            hashResult.Algorithm.Should().Be(Hashing.ExpectedSha256Algorithm);
            hashResult.Value.Should().Be(Hashing.ExpectedSha256Hash);
        }
Пример #4
0
        public void Sha256Hash_GetHash_Valid_1()
        {
            IHash hashAlgo = new Sha256Hash();

            using FileStream fileStream = new(Data.ExpectedHashFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);

            HashResult hashResult = hashAlgo.GetHash(fileStream);

            hashResult.Algorithm.Should().Be(Hashing.ExpectedSha256Algorithm);
            hashResult.Value.Should().Be(Hashing.ExpectedSha256Hash);
        }