Example #1
0
        public void IntersectNoEqualityComparer_SameKeyInSecondDict_TakesDuplicateKeyValuePair()
        {
            var first = new Dictionary<int, int> { { 2, 3 }, { 3, 5 }, {6, 4} };
            var second = new SortedList<int, int> { { 3, 2 }, { 4, 7 } };

            var expected = 1;
            var actual = first.Intersect(second).Count;
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void IntersectDefaultEqualityComparer_SameKeyDifferentValues_OnlyKeepsMatchingKeyAndValue()
        {
            var first = new Dictionary<int, int> { { 2, 3 }, { 3, 5 }, {6, 4} };
            var second = new SortedList<int, int> { { 3, 2 }, { 6, 4 } };

            var expected = 1;
            var actual = first.Intersect(second, EqualityComparer<KeyValuePair<int, int>>.Default).Count;
            Assert.AreEqual(expected, actual);
        }