public void AccessTimeoutTest() { NFileCache target = new NFileCache("AccessTimeoutTest"); target.AccessTimeout = new TimeSpan(1); target["foo"] = 0; // Lock actual file system record string itemPath = target.GetItemPath("foo"); using (FileStream stream = File.Open(itemPath, FileMode.Create)) { object result = target["foo"]; } }
public void RemoveTest() { NFileCache target = new NFileCache("RemoveTest"); target.Set("test", "test", DateTime.Now.AddDays(3)); object result = target.Get("test"); Assert.AreEqual("test", result); // Check file system to be sure item was created string itemPath = target.GetItemPath("test"); Assert.IsTrue(File.Exists(itemPath)); // Now delete target.Remove("test"); result = target["test"]; Assert.IsNull(result); // Check file system to be sure item was removed Assert.IsFalse(File.Exists(itemPath)); }