public async Task GetFromCache() { await _cache.RemoveAsync(CacheKeys.CountriesKey); var countries = await _repo.Get(); Assert.AreEqual(2, countries.ToList().Count); }
public async Task CacheDown_GetFromDatabase() { string connectionString = "Server=.\\sqlexpress;Database=Database1;Integrated Security=true"; var redisCacheOptions = new RedisCacheOptions() { Hostname = "incorrect_host", Prefix = "cacheCountryTests", Port = "6379", }; var cacheTtlOptions = Options.Create(new CacheTtlOptions() { CountriesTtlInSeconds = 10 }); var redisAppCache = new RedisAppCache(redisCacheOptions); var repo = new SqlCachingCountryRepository(new SqlServerDataContext(connectionString, 200, NullLogger <SqlServerDataContext> .Instance), redisAppCache, cacheTtlOptions, NullLogger <SqlCachingCountryRepository> .Instance); var countries = await repo.Get(); Assert.AreEqual(2, countries.ToList().Count); }