Пример #1
0
        public void UnionWithTest()
        {
            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.UnionWith(intSetSecond);
            var check  = new int[] { 5, -32, 0, 16, 13, 56, 44 };
            var output = new int[intSetFirst.Count];

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