public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value, Node node) { var clock = ImmutableSortedDictionary <Node, long> .Empty; var lwwSet = new LWW_SetWithVC <TestType>(); lwwSet = lwwSet.Assign(value, new VectorClock(clock.Add(node, 0))); var lookup = lwwSet.Lookup(value); Assert.True(lookup); }
public void Lookup_AddedAndNotRemoved_ReturnsTrue(TestType value, Node node) { var clock = ImmutableSortedDictionary <Node, long> .Empty; var lwwSet = new LWW_SetWithVC <TestType>(); var element = new LWW_SetWithVCElement <TestType>(value, new VectorClock(clock.Add(node, 0))); lwwSet = lwwSet.Merge(new[] { element }.ToImmutableHashSet(), ImmutableHashSet <LWW_SetWithVCElement <TestType> > .Empty); var lookup = lwwSet.Lookup(value); Assert.True(lookup); }
public void Lookup_AddedAndRemoved_ReturnsFalse(TestType value, Node node) { var clock = ImmutableSortedDictionary <Node, long> .Empty; var lwwSet = new LWW_SetWithVC <TestType>(); var add = new LWW_SetWithVCElement <TestType>(value, new VectorClock(clock.Add(node, 0))); var remove = new LWW_SetWithVCElement <TestType>(value, new VectorClock(clock.Add(node, 1))); lwwSet = lwwSet.Merge(new[] { add }.ToImmutableHashSet(), new[] { remove }.ToImmutableHashSet()); var lookup = lwwSet.Lookup(value); Assert.False(lookup); }
public void Lookup_AddedAndRemoved_ReturnsFalse(TestType value, Node node) { var clock = ImmutableSortedDictionary <Node, long> .Empty; var lwwSet = new LWW_SetWithVC <TestType>(); var add = new LWW_SetWithVCElement <TestType>(value, new VectorClock(clock.Add(node, 0))); var remove = new LWW_SetWithVCElement <TestType>(value, new VectorClock(clock.Add(node, 1))); lwwSet = lwwSet.Assign(add.Value, add.VectorClock); lwwSet = lwwSet.Remove(remove.Value, remove.VectorClock); var lookup = lwwSet.Lookup(value); Assert.False(lookup); }