public void Can_Cache_Html_Threads() { TestTool.RunTasks(4, () => { _htmlCache = new HtmlAsyncCache(); Can_Cache_Html(); }); }
public void Test_CoordinationDataStructures_AsyncCoordination_AsyncCache_Cache() { //异步cached var asyncCache = new AsyncCache <int, int>(e => Task.Factory.StartNew <int>(() => 10)); var task = asyncCache.GetValue(1); Assert.AreEqual(true, task.IsCompleted); Assert.AreEqual(1, task.Result); var httpCache = new HtmlAsyncCache(); var pageTask = httpCache.GetValue(new Uri("http://www.baidu.com")); Assert.AreEqual(true, pageTask.IsCompleted); }