public void GivenLine_GoodOrgID_WhenInitSwitch_ThenExpectedValueSet()
        {
            var expected = "myval2";

            var actual = _sut2.GetValue("TestKey", "wrongval");

            Assert.AreEqual(expected.ToLower(), actual);
        }
        public void GivenLowerCaseValue_WhenGetValue_ThenExpectedValueReturned()
        {
            var expected = "myval";

            var actual = _sut.GetValue("testkey");

            Assert.AreEqual(expected.ToLower(), actual);
        }
Beispiel #3
0
        private static string m_strIsBS       = "true"; //是否为BS系统应用


        public ConnectionPool_mysql()
        {
            m_strIsBS = IniConfig.GetValue("DBConnection", "IsBS");
            if (m_strIsBS == "")
            {
                m_strIsBS = "true";
            }
            if (m_strIsBS == "true")
            {
                m_strConnection = ConfigurationManager.AppSettings["con_mysql"].ToString();
            }
            else
            {
                m_strConnection = IniConfig.GetValue("DBConnection", "CnnString");
            }

            if (m_strConnection.Contains("Data Source"))
            {
                //将未编码连接字串进行编码后再保存
                //if (m_strIsBS == "true")
                //    //ConfigurationManager.AppSettings["con"] = DI_JH.Functions.StringToBase64(m_strConnection);
                //else
                //    DI_JH.IniConfig.WriteValue("DBConnection", "CnnString", ServerConnection.StringToBase64(m_strConnection));
            }
            else//将读出的连接编码字串解码
                //m_strConnection = DI_JH.Functions.StringFromBase64(m_strConnection);

            {
                ConnectionPool_mysql.con = new MySql.Data.MySqlClient.MySqlConnection(m_strConnection);
            }
        }
Beispiel #4
0
 public string GetValue(string key, string defaultValue = null)
 {
     return(config.GetValue(key, defaultValue));
 }