Example #1
0
        public void CompareFileHashWithTextHash()
        {
            const string Path         = "Test.txt";
            const string Contents     = "Hello! รจ";
            const string ExpectedSha1 = "c42b73d217dfd2b7a2e701f1961fb3b8504ed369";

            Storage.Reset(() => new FileSystemStorage());

            Storage.WriteAllText(Path, Contents);
            var text = Storage.ReadAllText(Path);

            text.Should().Be(Contents);

            var textHash = Hashing.ComputeHex(text);
            var fileHash = Storage.File(Path).Hash();

            textHash.Should().Be(ExpectedSha1);
            fileHash.Should().Be(ExpectedSha1);
        }
Example #2
0
 public void VerifyDefaultAlgorithmHex()
 {
     Hashing.ComputeHex(ClearText).Should().Be("f7ff9e8b7bb2e09b70935a5d785e0cc5d9d0abf0");
 }