public async Task TestForFilesInDifferentOrders() { var f1 = MakeRootFile("TestHitDriver1"); var f2 = MakeRootFile("TestHitDriver2"); var query = MakeQuery(0); /// Cache a result var h = new ROOTNET.NTH1F("hi", "there", 10, 0.0, 10.0) { Directory = null }; h.SetBinContent(1, 5.0); var q = new QueryResultCache(); var k1 = q.GetKey(new Uri[] { f1, f2 }, "test", null, null, query, dateChecker: u => File.GetLastWriteTime(u.LocalPath)); var k2 = q.GetKey(new Uri[] { f2, f1 }, "test", null, null, query, dateChecker: u => File.GetLastWriteTime(u.LocalPath)); await q.CacheItem(k1, new NTObject[] { h }.AsRunInfoArray()); // // Now, do the lookup, but with files in a different order. // var r1 = await q.Lookup <int>(k1, new DummySaver(), null); var r2 = await q.Lookup <int>(k2, new DummySaver(), null); Assert.IsTrue(r1.Item1, "expected hit for same key"); Assert.IsTrue(r2.Item1, "expected hit for second key with different files"); }
internal async Task <Tuple <bool, T> > Lookup <T>( QueryResultCache target, Uri _rootFile, string treeName, object[] inputObjects, string[] cacheStrings, QueryModel queryModel, IVariableSaver varSaver, bool checkDates = false, Func <IAddResult> generateAdder = null ) { var result = await target.Lookup <T>(target.GetKey(new Uri[] { _rootFile }, treeName, inputObjects, cacheStrings, queryModel, recheckDates: checkDates, dateChecker: u => File.GetLastWriteTime(u.LocalPath)), varSaver, null, generateAdder); Assert.IsNotNull(result, "Should never return a null lookup"); return(result); }