Exemple #1
0
        public void Update_NotExistingValue_DoesNotAddToTheAddsSet(TestType value, Guid tag, Node node)
        {
            var clock = ImmutableSortedDictionary <Node, long> .Empty;

            var ourSet = new OUR_SetWithVC <TestType>();

            ourSet = ourSet.Update(value, tag, new VectorClock(clock.Add(node, 0)));

            var element = new OUR_SetWithVCElement <TestType>(value, tag, new VectorClock(clock.Add(node, 0)));

            Assert.DoesNotContain(element, ourSet.Adds);
        }
Exemple #2
0
        public void Update_UpdatesElementInAddsSet(TestType value, Guid tag, Node node)
        {
            var clock = ImmutableSortedDictionary <Node, long> .Empty;

            var ourSet = new OUR_SetWithVC <TestType>();

            var newValue   = _builder.Build(value.Id);
            var newElement = new OUR_SetWithVCElement <TestType>(newValue, tag, new VectorClock(clock.Add(node, 1)));

            ourSet = ourSet.Add(value, tag, new VectorClock(clock.Add(node, 0)));
            ourSet = ourSet.Update(newValue, tag, new VectorClock(clock.Add(node, 1)));

            var element = new OUR_SetWithVCElement <TestType>(value, tag, new VectorClock(clock.Add(node, 0)));

            Assert.Contains(newElement, ourSet.Adds);
            Assert.DoesNotContain(element, ourSet.Adds);
        }
Exemple #3
0
        public void Lookup_AddedRemovedAndUpdated_ReturnsTrue(TestType value, Guid tag, Node node)
        {
            var clock = ImmutableSortedDictionary <Node, long> .Empty;

            var ourSet = new OUR_SetWithVC <TestType>();

            ourSet = ourSet.Add(value, tag, new VectorClock(clock.Add(node, 0)));
            ourSet = ourSet.Remove(value, tag, new VectorClock(clock.Add(node, 1)));

            var newValue = _builder.Build(value.Id);

            ourSet = ourSet.Update(newValue, tag, new VectorClock(clock.Add(node, 1)));

            var lookup = ourSet.Lookup(newValue);

            Assert.True(lookup);
        }