Exemple #1
0
        public void AppSettingsProvider_Create_EscapedSettings()
        {
            var prefix = typeof(EscapedSetting).FullName.Replace("+", ".");

            ConfigurationManager.AppSettings[prefix + ".EscapedValue"] = "$$MyDollarEscapedPassword$";

            var s = AppSettingsProvider.Create <EscapedSetting>();

            Assert.AreEqual(s.EscapedValue, "$MyDollarEscapedPassword$");
        }
        public void AppSettingsProvider_Create_InnerClassObjectSettings()
        {
            var prefix = typeof(MyInnerTestSettings).FullName.Replace("+", ".");

            ConfigurationManager.AppSettings[prefix + ".UserName"] = "******";
            ConfigurationManager.AppSettings[prefix + ".Password"] = "******";

            var s = AppSettingsProvider.Create <MyInnerTestSettings>();

            Assert.AreEqual(s.UserName, "Kees C. Bakker");
            Assert.AreEqual(s.Password, "1337!42");
        }
Exemple #3
0
        public void AppSettingsProvider_Create_ReusedSetting()
        {
            var prefix = typeof(NetworkSettings).FullName.Replace("+", ".");

            ConfigurationManager.AppSettings[prefix + ".IP"]   = "127.0.0.1";
            ConfigurationManager.AppSettings[prefix + ".Port"] = "$DefaultPort$";
            ConfigurationManager.AppSettings["DefaultPort"]    = "8080";

            var s = AppSettingsProvider.Create <NetworkSettings>();

            Assert.AreEqual(s.IP, "127.0.0.1");
            Assert.AreEqual(s.Port, 8080);
        }