Exemple #1
0
        public void TestHash()
        {
            const string data = "Cheese for Everyone!";

            File.WriteAllText("test.data", data);
            Assert.AreEqual("eSIyd+KOG3s=", "test.data".FileHashCached(), "Hash is cached");
            Assert.IsTrue(Utils.TryGetHashCache("test.data", out var fileHash), "New caching method is invoked");
            Assert.AreEqual("eSIyd+KOG3s=", fileHash, "The correct hash value is cached");
            Assert.AreNotEqual("eSIyd+KOG3s=", File.ReadAllText("test.data" + Consts.HashFileExtension), "We don't store the hash in plaintext");
        }