Пример #1
0
        public void Render(string sourceText, string expected)
        {
            var storage = new VariableStorage();
            storage["empty"] = "";
            storage["name1"] = "value1";
            storage["name2"] = "value2";

            var renderedText = new ValueRenderer(sourceText).Render(storage);

            Assert.AreEqual(expected, renderedText);
        }
Пример #2
0
        public void SettingsLoader()
        {
            var storage = new VariableStorage();
            storage["machineName"] = "TestServer";

            var loader = new SettingsLoader(storage.CfgNodeConverter);

            var xmlCfg = @"<?xml version='1.0' encoding='utf-8' ?>
            <configuration>
            <Before Field='${machineName} ${var1}' />
            <variable name='var1' value='value1' />
            <After Field='${machineName} ${var1}' />
            </configuration>".ToXmlSettings();

            var settings = loader.LoadSettings(xmlCfg).Joined.ToAppSettings();

            Assert.AreEqual("TestServer value1", settings.Get<TestConfig>("Before").Field);
            Assert.AreEqual("TestServer value1", settings.Get<TestConfig>("After").Field);
        }
Пример #3
0
 public CfgNodeWrapper(ICfgNode wrapped, VariableStorage variableStorage)
 {
     _wrapped = wrapped;
     _variableStorage = variableStorage;
 }
Пример #4
0
 public CfgNodeWrapper(ICfgNode wrapped, VariableStorage variableStorage)
 {
     _wrapped         = wrapped;
     _variableStorage = variableStorage;
 }