Exemplo n.º 1
0
        public void ExceptWithTest()
        {
            var intSetFirst  = new GenericSet <int>();
            var intSetSecond = new GenericSet <int>();
            var data         = new int[] { 5, 16, -32, 56, 0, 5, 44, 16, 13 };

            for (int i = 0; i < data.Length / 2; ++i)
            {
                intSetFirst.Add(data[i]);
            }
            for (int i = data.Length / 2; i < data.Length; ++i)
            {
                intSetSecond.Add(data[i]);
            }
            intSetFirst.ExceptWith(intSetSecond);
            var check  = new int[] { -32, 56 };
            var output = new int[intSetFirst.Count];

            intSetFirst.CopyTo(output, 0);
            CollectionAssert.AreEqual(check, output);
        }