Esempio n. 1
0
        public void ExclusiveOrYieldsImmutableCone()
        {
            ISet mySet = new ListSet(new int[] { 1, 4 });
            ISet clone = Set.ExclusiveOr(mySet);

            Assert.IsNotNull(clone);
            Assert.AreEqual(3, clone.Count);
            Assert.Throws <NotSupportedException>(() => clone.Add("bad chair, bad chair"));
        }
Esempio n. 2
0
        public void ExclusiveOr()
        {
            Set.AddAll(UniqueStuff);
            SetForSetOps.AddAll(new object [] { "Bar", StuffOne });
            ISet xor = Set.ExclusiveOr(SetForSetOps);

            Assert.IsTrue(xor.Count == 3);
            Assert.IsTrue(xor.ContainsAll(new object [] { "Bar", StuffTwo, StuffThree }));
            Assert.IsFalse(object.ReferenceEquals(xor, Set), "Got back same instance after set operation.");
            Assert.IsTrue(Set.Count == UniqueStuff.Length);
            Assert.IsTrue(SetForSetOps.Count == 2);
        }
Esempio n. 3
0
        public void Xor()
        {
            ISet actual = Set.ExclusiveOr(one, two);

            Assert.IsNotNull(actual);
            Assert.AreEqual(3, actual.Count);
            Assert.IsTrue(actual.ContainsAll(new object [] { "Foo", 2, 3 }));
            CheckThatOriginalsHaveNotBeenModified();

            Assert.IsNull(Set.ExclusiveOr(null, null));

            actual = Set.ExclusiveOr(null, two);
            Assert.AreEqual(two, actual);

            actual = Set.ExclusiveOr(one, null);
            Assert.AreEqual(one, actual);
        }