コード例 #1
0
        public void UnionTest(int[] a, int[] b, int[] expected)
        {
            var listA = new VSArray <int>(a);
            var listB = new VSArray <int>(b);

            // Create new list, don't modify original
            var list2 = listA.Union(listB);

            Assert.That(listA, Is.EqualTo(a.ToVSArray()));
            Assert.That(listB, Is.EqualTo(b.ToVSArray()));
            Assert.That(list2, Is.EqualTo(expected.ToVSArray()));

            // Modify original (in-place)
            listA.UnionWith(listB);
            Assert.That(listA, Is.EqualTo(expected.ToVSArray()));
            Assert.That(listA, Is.EqualTo(list2));
        }