Esempio n. 1
0
        public async Task RefTypeDictT()
        {
            var evecache    = new EveSqlServerCache(Logger, AccountContextProvider);
            var cache       = new CacheLocalProvider(evecache);
            var refTypeDict = new RefTypeDict(cache, evecache);
            var result      = await refTypeDict.GetById(56);

            Assert.AreEqual("Manufacturing", result);
        }
        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)
            {
            }
        }