public void testExplicitRefreshAfterCompleteFileUpdate() { var file = Path.Combine(Path.GetTempPath(), "refresh"); try { System.IO.File.WriteAllLines(file, new string[] { "123,456,3.0" }); /// create a FileDataModel that always reloads when the underlying file has changed FileDataModel dataModel = new FileDataModel(file, false, 0L); Assert.AreEqual(3.0f, dataModel.GetPreferenceValue(123L, 456L), EPSILON); /// change the underlying file, /// we have to wait at least a second to see the change in the file's lastModified timestamp System.Threading.Thread.Sleep(2000); System.IO.File.WriteAllLines(file, new string[] { "123,456,5.0" }); dataModel.Refresh(null); Assert.AreEqual(5.0f, dataModel.GetPreferenceValue(123L, 456L), EPSILON); } finally { if (System.IO.File.Exists(file)) { System.IO.File.Delete(file); } } }