Пример #1
0
        public static async Task TestCacheAsync(Func <ICache> cacheFactory)
        {
            CacheTester tester = new CacheTester();

            var methods = tester.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);

            foreach (var testMethod in methods)
            {
                var cache = cacheFactory().WithSource(new Example());

                var testResult = testMethod.Invoke(tester, new object[] { cache });
                if (testResult is Task)
                {
                    await(testResult as Task);
                }
            }
        }
 public async Task Nuget_RedisCache()
 {
     await CacheTester.TestCacheAsync(CacheFactory);
 }
 public async Task Nuget_RuntimeMemoryCache()
 {
     await CacheTester.TestCacheAsync(CreateCache);
 }
 public async Task Nuget_SimpleCache()
 {
     Func <ICache> factory = () => new FluentDictionaryCache();
     await CacheTester.TestCacheAsync(factory);
 }