public void TestCacheHit() { const string filename = "time_series_covid19_deaths_global.csv"; HopkinsModelFileCacheReader reader = new HopkinsModelFileCacheReader( new HopkinsModelDowloader(filename), filename); reader.CacheInvalidate(); string data = reader.GetRawModel(); Assert.IsFalse(reader.CacheHit); data = reader.GetRawModel(); Assert.IsTrue(reader.CacheHit); reader.CacheInvalidate(); data = reader.GetRawModel(); Assert.IsFalse(reader.CacheHit); }
public void TestCacheExpire() { const string filename = "time_series_covid19_deaths_global.csv"; HopkinsModelFileCacheReader reader = new HopkinsModelFileCacheReader( new HopkinsModelDowloader(filename), filename); reader.CacheInvalidate(); string data = reader.GetRawModel(); Assert.IsFalse(reader.CacheHit); File.SetLastWriteTime(filename, DateTime.Now); data = reader.GetRawModel(); Assert.IsTrue(reader.CacheHit); File.SetLastWriteTime(filename, DateTime.Now.AddHours(-HopkinsModelFileCacheReader.EXPIRES_HOURS - 1)); data = reader.GetRawModel(); Assert.IsFalse(reader.CacheHit); }
public void TestCache() { const string filename = "time_series_covid19_deaths_global.csv"; HopkinsModelFileCacheReader reader = new HopkinsModelFileCacheReader( new HopkinsModelDowloader(filename), filename); string data = reader.GetRawModel(); Assert.IsTrue(File.Exists(filename)); }
public void TestReader() { const string filename = "time_series_covid19_deaths_global.csv"; HopkinsModelFileCacheReader reader = new HopkinsModelFileCacheReader( new HopkinsModelDowloader(filename), filename); string data = reader.GetRawModel(); Assert.AreNotEqual(data, string.Empty); }