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

            _ourSetService.DownstreamAdd(value, tag, new VectorClock(clock.Add(node, 0)));

            var repositoryValues = _repository.GetElements();
            var actualValues     = repositoryValues.Where(v => Equals(v.Value, value) && v.Tag == tag && v.VectorClock.Equals(new VectorClock(clock.Add(node, 0))));

            Assert.Single(actualValues);
        }
Example #2
0
        public void MergeAdds_SingleValueWithEmptyRepository_AddsElementsToTheRepository(TestType value, Guid tag, Node node)
        {
            var clock = ImmutableSortedDictionary <Node, long> .Empty;

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

            _ourSetService.Merge(new HashSet <OUR_OptimizedSetWithVCElement <TestType> > {
                element
            }.ToImmutableHashSet());

            var repositoryValues = _repository.GetElements();

            Assert.Equal(1, repositoryValues.Count(x => Equals(x, element)));
        }