コード例 #1
0
 public void Remove ()
 {
     Properties props = new Properties();
     props.Add ("foo", "this");
     props.Add ("bar", "is");
     Assert.AreEqual (2, props.Count);
     props.Remove ("foo");
     Assert.AreEqual (1, props.Count);
     Assert.IsFalse (props.ContainsKey ("foo"));
 }
コード例 #2
0
        public void WhitespaceProperties()
        {
            string input = "key1 =\t\nkey2:\nkey3";

            Stream s = new MemoryStream(Encoding.ASCII.GetBytes(input));
            Properties props = new Properties();
            props.Load(s);

            Assert.AreEqual(string.Empty, props["key1"], "key1 should have empty value");
            Assert.AreEqual(string.Empty, props["key2"], "key2 should have empty value");
            Assert.IsTrue(props.ContainsKey("key3"));
            Assert.IsNull(props["key3"]);
        }