Beispiel #1
0
        public void GetDistinctItemsTest()
        {
            List <int> list1 = new List <int> {
                1, 2, 3, 4,
            };
            List <int> list2 = new List <int> {
                1, 2
            };
            List <int> list3 = new List <int> {
                1, 2, 5
            };
            var distinct = ListExtensions.GetDistinctItems(new List <List <int> > {
                list1, list2, list3
            }).ToArray();

            Assert.AreEqual(3, distinct.Count());
            Assert.AreEqual(3, distinct[0]);
            Assert.AreEqual(4, distinct[1]);
            Assert.AreEqual(5, distinct[2]);

            ListExtensions.GetDistinctItemsP(list1, list2, list3).ToArray();
            Assert.AreEqual(3, distinct.Count());
            Assert.AreEqual(3, distinct[0]);
            Assert.AreEqual(4, distinct[1]);
            Assert.AreEqual(5, distinct[2]);
        }