public void UnionYieldsImmutableCone() { ISet mySet = new ListSet(new int[] { 1, 4 }); ISet clone = Set.Union(mySet); Assert.IsNotNull(clone); Assert.AreEqual(4, clone.Count); Assert.Throws <NotSupportedException>(() => clone.Add("bad chair, bad chair")); }
public void Union() { Set.AddAll(UniqueStuff); SetForSetOps.AddAll(new object [] { "Bar", StuffOne }); ISet union = Set.Union(SetForSetOps); Assert.IsTrue(union.Count == UniqueStuff.Length + 1); Assert.IsFalse(object.ReferenceEquals(union, Set), "Got back same instance after set operation."); Assert.IsTrue(Set.Count == UniqueStuff.Length); Assert.IsTrue(SetForSetOps.Count == 2); }
public void Union() { ISet actual = Set.Union(one, two); Assert.IsNotNull(actual); Assert.AreEqual(4, actual.Count); Assert.IsTrue(actual.ContainsAll(new object [] { 1, "Foo", 2, 3 })); CheckThatOriginalsHaveNotBeenModified(); Assert.IsNull(Set.Union(null, null)); actual = Set.Union(null, two); Assert.AreEqual(two, actual); actual = Set.Union(one, null); Assert.AreEqual(one, actual); }