public void Loading_files_should_work() { /* Arrange */ string fileOne = "testfileone.xml"; string fileTwo = "testfiletwo.xml"; string fileTthree = "testfilethree.xml"; TestConfigFactory.CreateXmlFile(fileOne, "<configuration><section1 /></configuration>", false); TestConfigFactory.CreateXmlFile(fileTwo, "<configuration><section2 /></configuration>", true); IConfigProvider p1 = new MultiFileConfigProvider(fileOne, fileTthree, fileTwo); IConfigProvider p2 = new MultiFileConfigProvider(new List<string> { fileOne, fileTthree, fileTwo }); /* Act */ p1.Initialize(); var docs1 = p1.LoadConfig().ToList(); var docs2 = p2.LoadConfig().ToList(); /* Assert */ docs1.Should().HaveCount(2); docs1[0].Should().HaveElement("section1"); docs1[1].Should().HaveElement("section2"); docs2.Should().HaveCount(2); docs2[0].Should().HaveElement("section1"); docs2[1].Should().HaveElement("section2"); p1.ModifiedSinceLoad.Should().BeFalse(); }
public void Modified_since_load_should_work_as_expected() { /* Arrange */ string fileOne = "testfilemultieditone.xml"; string fileTwo = "testfilemultiedittwo.xml"; TestConfigFactory.CreateXmlFile(fileOne, "<configuration><section1 /></configuration>", false); TestConfigFactory.CreateXmlFile(fileTwo, "<configuration><section1 /></configuration>", false); var p = new MultiFileConfigProvider(fileOne, fileTwo); /* Act */ var docs = p.LoadConfig().ToList(); Thread.Sleep(10); TestConfigFactory.CreateXmlFile(fileTwo, "<configuration><section2 /></configuration>", false); /* Assert */ p.ModifiedSinceLoad.Should().BeTrue(); }