public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value) { var pSet = new P_OptimizedSet <TestType>(); pSet = pSet.Merge(new[] { new P_OptimizedSetElement <TestType>(value, false) }.ToImmutableHashSet()); var lookup = pSet.Lookup(value); Assert.True(lookup); }
public void Merge_MergesAddsAndRemoves(TestType one, TestType two, TestType three) { var elementOne = new P_OptimizedSetElement <TestType>(one, false); var elementTwo = new P_OptimizedSetElement <TestType>(two, true); var elementThree = new P_OptimizedSetElement <TestType>(one, true); var elementFour = new P_OptimizedSetElement <TestType>(three, false); var pSet = new P_OptimizedSet <TestType>(new[] { elementOne, elementTwo }.ToImmutableHashSet()); var newPSet = pSet.Merge(new[] { elementThree, elementFour }.ToImmutableHashSet()); Assert.Equal(4, newPSet.Elements.Count); Assert.Contains(newPSet.Elements, e => Equals(e, elementOne)); Assert.Contains(newPSet.Elements, e => Equals(e, elementTwo)); Assert.Contains(newPSet.Elements, e => Equals(e, elementThree)); Assert.Contains(newPSet.Elements, e => Equals(e, elementFour)); }