本文整理汇总了C#中ConfigManager.Update方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigManager.Update方法的具体用法?C# ConfigManager.Update怎么用?C# ConfigManager.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigManager
的用法示例。
在下文中一共展示了ConfigManager.Update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInstanceClassWithoutKey
public void TestInstanceClassWithoutKey()
{
InstanceConfig config = new InstanceConfig();
ConfigManager configManager = new ConfigManager();
configManager.Register(config);
configManager.RegisterProvider(new ConfigurationProviderAppConfig());
configManager.Update();
Assert.AreEqual("xx1", config.Test1);
Assert.AreEqual(99, config.SubObject1.TestInt1);
Assert.IsNotNull(config.IntValues);
Assert.IsNotNull(config.StringValues);
Assert.AreEqual("x", config.StringValues["ValX"]);
Assert.AreEqual("y", config.StringValues["ValY"]);
Assert.AreEqual("z", config.StringValues["ValZ"]);
Assert.AreEqual(3, config.StringValues.Count);
Assert.AreEqual(1, config.IntValues["Val1"]);
Assert.AreEqual(2, config.IntValues["Val2"]);
Assert.AreEqual(3, config.IntValues["Val3"]);
Assert.AreEqual(3, config.IntValues.Count);
}
示例2: TestDefaults
public void TestDefaults()
{
InstanceXmlConfig config = new InstanceXmlConfig();
ConfigManager configManager = new ConfigManager();
configManager.Register(config);
configManager.RegisterProvider(new ConfigurationProviderXmlConfig(Environment.CurrentDirectory + "\\Config.xml"));
configManager.Update();
Assert.AreEqual("test", config.SubGroupProp1.SubProp3);
Assert.AreEqual("yeah", config.SubGroupProp1.SubProp4);
}
示例3: TestStaticClassWithKey
public void TestStaticClassWithKey()
{
ConfigManager configManager = new ConfigManager();
configManager.Register<StaticConfig2>();
configManager.RegisterProvider(new ConfigurationProviderAppConfig());
configManager.Update();
Assert.AreEqual("xx2", StaticConfig2.Test1);
Assert.AreEqual(88, StaticConfig2.SubObject1.TestInt1);
}