public void ChangeSeveralTimesConfigFileTest()
        {
            int reloaded = 0;
            var fileName = this.GenerateConfigPath();

            WriteConfigFileContent1(fileName);

            var parser = new ReloadedConfigSettingsParser(fileName, () => reloaded++, null, reloadedTime);

            reloaded.Should().Be(0);
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");

            WriteConfigFileContent2(fileName);
            System.Threading.Thread.Sleep(waitLessForReloadedTime);
            reloaded.Should().Be(0);
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");

            WriteConfigFileContent3(fileName);
            System.Threading.Thread.Sleep(waitLessForReloadedTime);
            reloaded.Should().Be(0);
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");

            Assert.That(() => reloaded, Is.EqualTo(1).After((int)waitForReloadedTime.TotalMilliseconds).PollEvery(10));
            parser.HasVariable("testVariableName").Should().Be(false);
            parser.HasVariable("testVariableName2").Should().Be(false);
            parser.GetVariableValue("testVariableName3").Should().Be("testVariableValue3");
        }
        public void RelativePathTest()
        {
            int reloaded = 0;
            var fileName = "_config.xml";

            WriteConfigFileContent1(fileName);
            var parser = new ReloadedConfigSettingsParser(fileName, () => reloaded++, null, reloadedTime);

            reloaded.Should().Be(0);
            parser.HasVariable("testVariableName2").Should().Be(false);
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");

            WriteConfigFileContent2(fileName);
            Assert.That(() => reloaded, Is.EqualTo(1).After((int)waitForReloadedTime.TotalMilliseconds).PollEvery(10));
            parser.HasVariable("testVariableName").Should().Be(false);
            parser.GetVariableValue("testVariableName2").Should().Be("testVariableValue2");
        }
        public void ChangeImportFileTest()
        {
            int reloaded       = 0;
            var fileName       = this.GenerateConfigPath();
            var importFileName = this.GenerateConfigPath();

            AddImport(fileName, importFileName);
            WriteConfigFileContent1(importFileName);

            var parser = new ReloadedConfigSettingsParser(fileName, () => reloaded++, null, reloadedTime);

            reloaded.Should().Be(0);
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");
            parser.HasVariable(null, "testVariableName2").Should().Be(false);

            WriteConfigFileContent2(importFileName);

            reloaded.Should().Be(0);
            Assert.That(() => reloaded, Is.EqualTo(1).After((int)waitForReloadedTime.TotalMilliseconds).PollEvery(10));
            parser.HasVariable(null, "testVariableName").Should().Be(false);
            parser.GetVariableValue("testVariableName2").Should().Be("testVariableValue2");
        }
        public void CreateFolderWithConfigFileTest()
        {
            int reloaded = 0;
            var fileName = this.GenerateConfigPath($"subfolder_{Guid.NewGuid()}");
            var parser   = new ReloadedConfigSettingsParser(fileName, () => reloaded++, null, reloadedTime);

            reloaded.Should().Be(0);
            parser.HasVariable("testVariableName").Should().Be(false);

            var directory = Path.GetDirectoryName(fileName);

            Directory.CreateDirectory(directory);
            WriteConfigFileContent1(fileName);

            Assert.That(() => reloaded, Is.EqualTo(1).After((int)waitForReloadedTime.TotalMilliseconds).PollEvery(10));
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");
        }
        public void RenameConfigFileTest()
        {
            int reloaded  = 0;
            var fileName1 = this.GenerateConfigPath();
            var fileName2 = this.GenerateConfigPath();

            WriteConfigFileContent1(fileName1);
            WriteConfigFileContent2(fileName2);

            var parser = new ReloadedConfigSettingsParser(fileName1, () => reloaded++, null, reloadedTime);

            reloaded.Should().Be(0);
            parser.GetVariableValue("testVariableName").Should().Be("testVariableValue");

            File.Delete(fileName1);
            File.Move(fileName2, fileName1);
            Assert.That(() => reloaded, Is.EqualTo(1).After((int)waitForReloadedTime.TotalMilliseconds).PollEvery(10));
            parser.HasVariable("testVariableName").Should().Be(false);
            parser.GetVariableValue("testVariableName2").Should().Be("testVariableValue2");
        }