public void ConfigTest5Test()
        {
            ConfigTest5 configTest5 = ConfigManager.GetConfigClass <ConfigTest5>();

            Assert.AreEqual(Constant.DefalutDataConverterTestValue1, configTest5.TestString);
            Assert.AreEqual(int.Parse(Constant.DefalutDataConverterTestValue2), configTest5.TestInt);
            Assert.AreEqual(long.Parse(Constant.DefalutDataConverterTestValue2), configTest5.TestLong);
            Assert.AreEqual(uint.Parse(Constant.DefalutDataConverterTestValue2), configTest5.TestUint);
            Assert.AreEqual(ulong.Parse(Constant.DefalutDataConverterTestValue2), configTest5.TestUlong);
            Assert.AreEqual(float.Parse(Constant.DefalutDataConverterTestValue3), configTest5.TestFloat);
            Assert.AreEqual(double.Parse(Constant.DefalutDataConverterTestValue3), configTest5.TestDouble);
            Assert.AreEqual(decimal.Parse(Constant.DefalutDataConverterTestValue3), configTest5.TestDecimal);
            Assert.AreEqual((DisconfNodeType)(int.Parse(Constant.DefalutDataConverterTestValue4)), configTest5.TestEnumInt);
            Assert.AreEqual(Enum.Parse(typeof(DisconfNodeType), Constant.DefalutDataConverterTestValue9, true), configTest5.TestEnumString);
            Assert.AreEqual((Guid)Guid.Parse(Constant.DefalutDataConverterTestValue5), configTest5.TestGuid);
            Assert.AreEqual((Type)Type.GetType(Constant.DefalutDataConverterTestValue6), configTest5.TestType);
            Assert.AreEqual((bool)bool.Parse(Constant.DefalutDataConverterTestValue7), configTest5.TestBool);
            Assert.AreEqual((char)char.Parse(Constant.DefalutDataConverterTestValue8), configTest5.TestChar);
            Assert.AreEqual((DateTime)DateTime.Parse(Constant.DefalutDataConverterTestValue10), configTest5.TestDateTime);

            Assert.IsNotNull(configTest5.TestStringList);
            Assert.AreEqual(2, configTest5.TestStringList.Count);
            Assert.AreEqual("host=127.0.0.1", configTest5.TestStringList[0]);
            Assert.AreEqual("port=81", configTest5.TestStringList[1]);

            Assert.IsNotNull(configTest5.TestStringDictionary);
            Assert.AreEqual(2, configTest5.TestStringDictionary.Count);
            Assert.AreEqual("127.0.0.1", configTest5.TestStringDictionary["Host"]);
            Assert.AreEqual("81", configTest5.TestStringDictionary["Port"]);

            _webApi.GetConfigItem("DefalutDataConverterTestValue1").Data = "Hello!";
            ConfigStorageManager.ReloadConfigItem(new ConfigMetadataApiResult()
            {
                Name = "DefalutDataConverterTestValue1", UpdateTime = DateTime.Now.ToString(CultureInfo.InvariantCulture)
            });

            Assert.AreEqual(Constant.DefalutDataConverterTestValue1, configTest5.TestString);

            ConfigTest5 newConfigTest5 = ConfigManager.GetConfigClass <ConfigTest5>();

            Assert.AreEqual("Hello!", newConfigTest5.TestString);
        }
Пример #2
0
        public void Invoke()
        {
            ConfigTest5 configTest5 = ConfigManager.GetConfigClass <ConfigTest5>();

            Console.WriteLine("ConfigTest5.TestString Changed: {0}", configTest5.TestString);
        }