コード例 #1
0
ファイル: INIDataTests.cs プロジェクト: itff11/ini-parser
        public void GeyKey_data_retrieval()
        {
            var    input     = @"
global = 1
[section]
key = 2
";
            var    data      = new IniDataParser().Parse(input);
            var    separator = data.SectionKeySeparator;
            string key;

            // should succeed
            key = "global";
            Assert.AreEqual(data.GetKey(key), "1");

            key = string.Format("section{0}key", separator);
            Assert.AreEqual(data.GetKey(key), "2");

            // should fail
            key = null;
            Assert.IsNull(data.GetKey(key));

            key = "badglobal";
            Assert.IsNull(data.GetKey(key));

            key = string.Format("badsection{0}badkey", separator);
            Assert.IsNull(data.GetKey(key));
        }