public void TestIntersectWith() { var other = new[] { "item 1", "item 3" }; var skipNotifierAssertions = false; _set.CollectionChanged += (sender, args) => { if (skipNotifierAssertions || args.RemovedItems.IsEmpty()) { return; } Assert.IsEmpty(args.AddedItems); Assert.AreEqual(1, args.RemovedItems.Count); Assert.AreEqual("item 2", args.RemovedItems.First()); }; // Array _set.IntersectWith(other); ExpectChangeCalls(1); _set.Add("item 2"); ExpectChangeCalls(1); // HashSet _set.IntersectWith(new HashSet <string>(other)); ExpectChangeCalls(1); _set.Add("item 2"); ExpectChangeCalls(1); // ObservableSet _set.IntersectWith(new ObservableSet <string>(other)); ExpectChangeCalls(1); _set.Add("item 2"); ExpectChangeCalls(1); // No changes _set.IntersectWith(new[] { "item 1", "item 3", "item 2" }); ExpectChangeCalls(0); // Empty skipNotifierAssertions = true; _set.Clear(); ExpectChangeCalls(1); _set.IntersectWith(new[] { "item 1", "item 3" }); ExpectChangeCalls(0); }