public static async Task batch_load_reads_from_underlying_datasource_when_key_not_in_cache(Test t) { var cache = new BatchReadThroughCache <int, int>(new BatchValueIsKey <int, int>(), 10, null); var results = await cache.GetBatchAsync(new int[] { 2 }); t.AssertNot(null, results); t.Assert(1, results.Length); t.Assert(2, results[0]); }
public static async Task batch_load_reads_from_cache(Test t) { var cache = new BatchReadThroughCache <int, int>(new BatchValueIsKey <int, int>(), 10, null); t.Assert(2, cache[2]); t.Assert(1, cache.Count); var results = await cache.GetBatchAsync(new int[] { 2 }); t.Assert(1, cache.Count); t.AssertNot(null, results); t.Assert(1, results.Length); t.Assert(2, results[0]); }