public void FileExistsTest() { AppDomainUtils.RunInSeparateAppDomain(() => { var path = "~/index.cshtml"; Utils.SetupVirtualPathInAppDomain(path, ""); var cache = FileExistenceCache.GetInstance(); Assert.IsTrue(cache.FileExists(path)); Assert.IsFalse(cache.FileExists("~/test.cshtml")); }); }
public void FileExistsTimeExceededTest() { AppDomainUtils.RunInSeparateAppDomain(() => { var path = "~/index.cshtml"; Utils.SetupVirtualPathInAppDomain(path, ""); var cache = FileExistenceCache.GetInstance(); var cacheInternal = cache.CacheInternal; cache.MilliSecondsBeforeReset = 5; Thread.Sleep(300); Assert.IsTrue(cache.FileExists(path)); Assert.IsFalse(cache.FileExists("~/test.cshtml")); Assert.AreNotEqual(cacheInternal, cache.CacheInternal); }); }