public void MergeWithNonCompatibleParentType()
 {
     ManagedSet child = new ManagedSet();
     child.Add("one");
     child.MergeEnabled = true;
     child.Merge("hello");
 }
 public void MergeWithNullParent()
 {
     ManagedSet child = new ManagedSet();
     child.Add("one");
     child.MergeEnabled = true;
     Assert.AreSame(child, child.Merge(null));
 }
 public void MergeWithNonCompatibleParentType()
 {
     ManagedSet child = new ManagedSet();
     child.Add("one");
     child.MergeEnabled = true;
     Assert.Throws<InvalidOperationException>(() => child.Merge("hello"));
 }
 public void MergeEmptyChild()
 {
     ManagedSet parent = new ManagedSet();
     parent.Add("one");
     parent.Add("two");
     ManagedSet child = new ManagedSet();
     child.MergeEnabled = true;
     ISet mergedSet = (ISet) child.Merge(parent);
     Assert.AreEqual(2, mergedSet.Count);
 }
 public void MergeSunnyDay()
 {
     ManagedSet parent = new ManagedSet();
     parent.Add("one");
     parent.Add("two");
     ManagedSet child = new ManagedSet();
     child.Add("three");
     child.MergeEnabled = true;
     ISet mergedList = (ISet) child.Merge(parent);
     Assert.AreEqual(3, mergedList.Count);
 }
 public void MergeChildValueOverrideTheParents()
 {
     ManagedSet parent = new ManagedSet();
     parent.Add("one");
     parent.Add("two");
     ManagedSet child = new ManagedSet();
     child.Add("one");
     child.MergeEnabled = true;
     ISet mergedList = (ISet) child.Merge(parent);
     Assert.AreEqual(2, mergedList.Count);
 }
 public void MergeNotAllowedWhenMergeNotEnabled()
 {
     ManagedSet child = new ManagedSet();
     child.Merge(null);
 }
 public void MergeNotAllowedWhenMergeNotEnabled()
 {
     ManagedSet child = new ManagedSet();
     Assert.Throws<InvalidOperationException>(() => child.Merge(null), "Not allowed to merge when the 'MergeEnabled' property is set to 'false'");
 }