public void GetPropertyWithDefault () { Properties props = new Properties(); props.Add ("foo", "this"); props.Add ("bar", "is"); Assert.AreEqual ("this", props.GetProperty ("foo")); Assert.AreEqual ("is", props.GetProperty ("bar")); Assert.AreEqual ("it", props.GetProperty ("baz", "it")); }
public void GetPropertyWithDefault() { Properties props = new Properties(); props.Add("foo", "this"); props.Add("bar", "is"); Assert.AreEqual("this", props.GetProperty("foo")); Assert.AreEqual("is", props.GetProperty("bar")); Assert.AreEqual("it", props.GetProperty("baz", "it")); }
public void Instantiation () { Properties root = new Properties(); root.Add ("foo", "this"); root.Add ("bar", "is"); Properties props = new Properties(root); props.SetProperty("myPropertyKey", "myPropertyValue"); Assert.AreEqual (3, props.Count); Assert.AreEqual ("this", props.GetProperty ("foo")); Assert.AreEqual ("is", props.GetProperty ("bar")); Assert.AreEqual ("myPropertyValue", props.GetProperty ("myPropertyKey")); }
public void Instantiation() { Properties root = new Properties(); root.Add("foo", "this"); root.Add("bar", "is"); Properties props = new Properties(root); props.SetProperty("myPropertyKey", "myPropertyValue"); Assert.AreEqual(3, props.Count); Assert.AreEqual("this", props.GetProperty("foo")); Assert.AreEqual("is", props.GetProperty("bar")); Assert.AreEqual("myPropertyValue", props.GetProperty("myPropertyKey")); }
public void ListAndLoad() { Properties props = new Properties(); props.Add("foo", "this"); props.Add("bar", "is"); props.Add("baz", "it"); FileInfo file = new FileInfo("properties.test"); try { // write 'em out... using (Stream cout = file.OpenWrite()) { props.List(cout); } // read 'em back in... using (Stream cin = file.OpenRead()) { props = new Properties(); props.Load(cin); Assert.AreEqual(3, props.Count); Assert.AreEqual("this", props.GetProperty("foo")); Assert.AreEqual("is", props.GetProperty("bar")); Assert.AreEqual("it", props.GetProperty("baz", "it")); } } finally { try { file.Delete(); } catch (IOException) { } } }
public void ListAndLoad() { Properties props = new Properties(); props.Add ("foo", "this"); props.Add ("bar", "is"); props.Add ("baz", "it"); FileInfo file = new FileInfo ("properties.test"); try { // write 'em out... using (Stream cout = file.OpenWrite ()) { props.List (cout); } // read 'em back in... using (Stream cin = file.OpenRead ()) { props = new Properties (); props.Load (cin); Assert.AreEqual (3, props.Count); Assert.AreEqual ("this", props.GetProperty ("foo")); Assert.AreEqual ("is", props.GetProperty ("bar")); Assert.AreEqual ("it", props.GetProperty ("baz", "it")); } } finally { try { file.Delete (); } catch (IOException) { } } }