public void Lookup_OptimizedSameValueWithSeveralTags_ReturnsTrue(TestType value, Guid tag) { var orSet = new OR_OptimizedSet <TestType>(); orSet = orSet.Merge(new[] { new OR_OptimizedSetElement <TestType>(value, tag, false) }.ToImmutableHashSet()); orSet = orSet.Merge(new[] { new OR_OptimizedSetElement <TestType>(value, Guid.NewGuid(), false) }.ToImmutableHashSet()); orSet = orSet.Merge(new[] { new OR_OptimizedSetElement <TestType>(value, tag, true) }.ToImmutableHashSet()); var lookup = orSet.Lookup(value); Assert.True(lookup); }
public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value, Guid tag) { var orSet = new OR_OptimizedSet <TestType>(); orSet = orSet.Merge(new [] { new OR_OptimizedSetElement <TestType>(value, tag, false) }.ToImmutableHashSet()); var lookup = orSet.Lookup(value); Assert.True(lookup); }
public void Merge_MergesAddsAndRemoves(TestType one, TestType two, TestType three, Guid tagOne, Guid tagTwo, Guid tagThree) { var orSet = new OR_OptimizedSet <TestType>(new[] { new OR_OptimizedSetElement <TestType>(one, tagOne, false), new OR_OptimizedSetElement <TestType>(two, tagOne, true), new OR_OptimizedSetElement <TestType>(three, tagThree, false), }.ToImmutableHashSet()); var newOrSet = orSet.Merge(new[] { new OR_OptimizedSetElement <TestType>(one, tagOne, false), new OR_OptimizedSetElement <TestType>(one, tagTwo, true), new OR_OptimizedSetElement <TestType>(two, tagOne, false), new OR_OptimizedSetElement <TestType>(three, tagThree, false), }.ToImmutableHashSet()); Assert.Equal(5, newOrSet.Elements.Count); Assert.Contains(new OR_OptimizedSetElement <TestType>(one, tagOne, false), newOrSet.Elements); Assert.Contains(new OR_OptimizedSetElement <TestType>(two, tagOne, true), newOrSet.Elements); Assert.Contains(new OR_OptimizedSetElement <TestType>(three, tagThree, false), newOrSet.Elements); Assert.Contains(new OR_OptimizedSetElement <TestType>(one, tagTwo, true), newOrSet.Elements); }