Merge() public method

Merges the current value set with that of the supplied object.
The supplied object is considered the parent, and values in the callee's value set must override those of the supplied object.
If the supplied parent is null If merging is not enabled for this instance, /// (i.e. MergeEnabled equals false.
public Merge ( object parent ) : object
parent object The parent object to merge with
return object
Ejemplo n.º 1
0
 public void MergeWithNonCompatibleParentType()
 {
     ManagedList child = new ManagedList();
     child.Add("one");
     child.MergeEnabled = true;
     child.Merge("hello");
 }
Ejemplo n.º 2
0
 public void MergeWithNullParent()
 {
     ManagedList child = new ManagedList();
     child.Add("one");
     child.MergeEnabled = true;
     Assert.AreSame(child, child.Merge(null));
 }
Ejemplo n.º 3
0
 public void MergeWithNonCompatibleParentType()
 {
     ManagedList child = new ManagedList();
     child.Add("one");
     child.MergeEnabled = true;
     Assert.Throws<InvalidOperationException>(() => child.Merge("hello"));
 }
Ejemplo n.º 4
0
 public void MergeEmptyChild()
 {
     ManagedList parent = new ManagedList();
     parent.Add("one");
     parent.Add("two");
     ManagedList child = new ManagedList();
     child.MergeEnabled = true;
     IList mergedList = (IList) child.Merge(parent);
     Assert.AreEqual(2, mergedList.Count);
 }
Ejemplo n.º 5
0
 public void MergeChildValueOverrideTheParents()
 {
     //doesn't make much sense in the context of a list...
     ManagedList parent = new ManagedList();
     parent.Add("one");
     parent.Add("two");
     ManagedList child = new ManagedList();
     child.Add("one");
     child.MergeEnabled = true;
     IList mergedList = (IList) child.Merge(parent);
     Assert.AreEqual(3, mergedList.Count);
 }
Ejemplo n.º 6
0
 public void MergeNotAllowedWhenMergeNotEnabled()
 {
     ManagedList child = new ManagedList();
     child.Merge(null);
 }
Ejemplo n.º 7
0
 public void MergeNotAllowedWhenMergeNotEnabled()
 {
     ManagedList child = new ManagedList();
     Assert.Throws<InvalidOperationException>(() => child.Merge(null), "Not allowed to merge when the 'MergeEnabled' property is set to 'false'");
 }