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