Esempio n. 1
0
        public async Task GetHashAsyncTest()
        {
            // Arrange
            var handler = new MD5Hash();

            // Act
            string hash = await handler.GetHashAsync(sample);

            // Assert
            Assert.IsTrue(hash.Length > 0);
        }
Esempio n. 2
0
        public async Task GetAndCheckHashTest()
        {
            // Arrange
            var handler = new MD5Hash();

            // Act
            string hash = await handler.GetHashAsync(sample);

            bool matches = await handler.CheckHashAsync(sample, hash);

            // Assert
            Assert.IsTrue(matches);
        }
Esempio n. 3
0
        public async Task GetHashAsyncStreamTest()
        {
            // Arrange
            var handler = new MD5Hash();

            using var stream = new MemoryStream(Encoding.UTF8.GetBytes(sample));

            // Act
            string hash = await handler.GetHashAsync(stream);

            // Assert
            Assert.IsTrue(hash.Length > 0);
        }
Esempio n. 4
0
        public async Task GetAndCheckHashStreamTest()
        {
            // Arrange
            var handler = new MD5Hash();

            using var stream = new MemoryStream(Encoding.UTF8.GetBytes(sample));

            // Act
            string hash = await handler.GetHashAsync(stream);

            stream.Position = 0;
            bool matches = await handler.CheckHashAsync(stream, hash);

            // Assert
            Assert.IsTrue(matches);
        }