public async Task NormalFlow() { var evecache = new EveSqlServerCache(Logger, AccountContextProvider); var provider = new CacheLocalProvider(evecache); var result = await provider.Get <string>("ala", () => Task.FromResult(new Tuple <DateTime, string>(DateTime.UtcNow.AddMilliseconds(10), "kot"))); Assert.AreEqual("kot", result); await Task.Delay(TimeSpan.FromMilliseconds(50)).ConfigureAwait(false); var result2 = await provider.Get <string>("ala", () => Task.FromResult(new Tuple <DateTime, string>(DateTime.UtcNow.AddMilliseconds(500), "kot2"))); Assert.AreEqual("kot2", result2); }
public async Task WrongArgument() { var evecache = new EveSqlServerCache(Logger, AccountContextProvider); var provider = new CacheLocalProvider(evecache); try { var result = await provider.Get <string>("ala", null); Assert.IsTrue(false, "Unreachable"); } catch (ArgumentNullException) { } }