public void GetOrAddCachedVersion_Caches_File_Hash() { var cache = new System.Web.Caching.Cache(); var hash = AssetVersionCache.GetOrAddCachedVersion("test.txt", cache); var assetCache = cache.Get("__AssetVersions__") as ConcurrentDictionary <string, string>; Assert.AreEqual(1, cache.Count); Assert.AreEqual(1, assetCache.Count); Assert.AreEqual("5b9VrKRrgLl2zwVdUOwhwihZ2cwlYdjQTqgEVV+G624=", assetCache["test.txt"]); Assert.AreEqual(hash, assetCache["test.txt"]); var cachedHash = AssetVersionCache.GetOrAddCachedVersion("test.txt", cache); Assert.AreEqual(1, assetCache.Count); Assert.AreEqual(hash, cachedHash); }
public void ComputeHash_Returns_Sha256_Hash_of_File_Contents() { var hash = AssetVersionCache.ComputeHash("test.txt"); Assert.AreEqual("5b9VrKRrgLl2zwVdUOwhwihZ2cwlYdjQTqgEVV+G624=", hash); }