コード例 #1
0
 public void MergeEmptyChild()
 {
     ManagedNameValueCollection parent = new ManagedNameValueCollection();
     parent.Add("one", "one");
     parent.Add("two", "two");
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.MergeEnabled = true;
     NameValueCollection mergedMap = (NameValueCollection)child.Merge(parent);
     Assert.AreEqual(2, mergedMap.Count);
 }
コード例 #2
0
 public void MergeSunnyDay()
 {
     ManagedNameValueCollection parent = new ManagedNameValueCollection();
     parent.Add("one", "one");
     parent.Add("two", "two");
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.Add("three", "three");
     child.MergeEnabled = true;
     NameValueCollection mergedList = (NameValueCollection)child.Merge(parent);
     Assert.AreEqual(3, mergedList.Count);
 }
コード例 #3
0
 public void MergeChildValueOverrideTheParents()
 {
     ManagedNameValueCollection parent = new ManagedNameValueCollection();
     parent.Add("one", "one");
     parent.Add("two", "two");
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.Add("one", "fork");
     child.MergeEnabled = true;
     NameValueCollection mergedMap = (NameValueCollection)child.Merge(parent);
     Assert.AreEqual(2, mergedMap.Count);
     Assert.AreEqual("fork", mergedMap["one"]);
 }
コード例 #4
0
 public void MergeWithNonCompatibleParentType()
 {
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.MergeEnabled = true;
     Assert.Throws<InvalidOperationException>(() => child.Merge("hello"));
 }
コード例 #5
0
 public void MergeNotAllowedWhenMergeNotEnabled()
 {
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     Assert.Throws<InvalidOperationException>(() => child.Merge(null), "Not allowed to merge when the 'MergeEnabled' property is set to 'false'");
 }
コード例 #6
0
 public void MergeWithNullParent()
 {
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.MergeEnabled = true;
     Assert.AreSame(child, child.Merge(null));
 }
コード例 #7
0
 public void MergeWithNonCompatibleParentType()
 {
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.MergeEnabled = true;
     child.Merge("hello");
 }
コード例 #8
0
 public void MergeNotAllowedWhenMergeNotEnabled()
 {
     ManagedNameValueCollection child = new ManagedNameValueCollection();
     child.Merge(null);
 }