public void WasChangedExternally_WhenFileWasModified_ReturnsTrueUntilLoadIsPerformed() { var t = nameof(WasChangedExternally_WhenThereWasNoModification_ReturnsFalse); using (var file = TestFileName.Create(t, "x", Toml.FileExtension)) { // Arrange File.WriteAllText(file, "x=0"); var cfg = new FileConfig(new FileConfigSource(file)); cfg.Load(); using (var sw = File.AppendText(file)) { sw.WriteLine(); sw.WriteLine("y=1"); } // Act var r1 = cfg.WasChangedExternally(); var r2 = cfg.WasChangedExternally(); cfg.Load(); var r3 = cfg.WasChangedExternally(); // Assert r1.Should().Be(true); r2.Should().Be(true); r3.Should().Be(false); } }
public void WasChangedExternally_WhenFileWasNotLoadedAtLeastOnce_WillAlwaysReturnTrue() { var t = nameof(WasChangedExternally_WhenThereWasNoModification_ReturnsFalse); using (var file = TestFileName.Create(t, "x", Toml.FileExtension)) { // Arrange File.WriteAllText(file, "x=0"); var cfg = new FileConfig(new FileConfigSource(file)); // Act var r1 = cfg.WasChangedExternally(); var r2 = cfg.WasChangedExternally(); // Assert r1.Should().Be(true); r2.Should().Be(true); } }
public void WasChangedExternally_WhenThereWasNoModification_ReturnsFalse() { var t = nameof(WasChangedExternally_WhenThereWasNoModification_ReturnsFalse); using (var file = TestFileName.Create(t, "x", Toml.FileExtension)) { // Arrange File.WriteAllText(file, "x=0"); var cfg = new FileConfig(new FileConfigSource(file)); cfg.Load(); // Act var r = cfg.WasChangedExternally(); // Assert r.Should().Be(false); } }