static TemplateField() { TagLib = new TagLib(); TilesConfigurationSection config = TilesConfigurationSection.Get(); var prefix = TemplateFieldPrefixHelper.BuildPrefix(HostingEnvironment.ApplicationPhysicalPath, config.FilePrefix); RefreshJob.REFRESH_INTERVAL = config.RefreshIntervalSeconds; _configuration = new TileXmlConfigurator( TagLib, config.ConfigFilePath, prefix ); TILES = new TilesSet(_configuration); }
public void TestRefreshConfigByFile() { string tempTile = Path.GetTempFileName(); File.Copy("Configuration\\tiles.smallconfig.xml", tempTile, true); File.SetLastWriteTime(tempTile, DateTime.Now.AddDays(-1)); try { var config = new TileXmlConfigurator(_lib, tempTile); var ts = new TilesSet(config); Assert.That(ts.Contains("a")); Assert.That(ts.Contains("b")); Assert.That(!ts.Contains("c")); File.Copy("Configuration\\tiles.config.xml", tempTile, true); ts.Refresh(); Assert.That(ts.Contains("a")); Assert.That(ts.Contains("b")); Assert.That(ts.Contains("c")); } finally { File.Delete(tempTile); } }