public void Intersect_returns_intersection_using_provided_equality_function() { var setA = new[] { "a", "b" }; var setB = new[] { "A", "C" }; Assert.True( new[] { "a" }.SequenceEqual( setA.Intersect(setB, (a, b) => a.Equals(b, StringComparison.OrdinalIgnoreCase)))); }
public void IntersectTest() { // ARRANGE var list1 = new[] { "a", "aa", "aaa", "aaaa" }; var list2 = new[] { "dd", "eeee" }; // ACT var intersect = list1.Intersect(list2, x => x.Length).ToList(); // ASSERT CollectionAssert.AreEqual(new[] { "aa", "aaaa" }, intersect); }