Esempio n. 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.GetAdds();
            var actualValues     = repositoryValues.Where(v => Equals(v.Value, value) && v.Tag == tag && v.VectorClock.Equals(new VectorClock(clock.Add(node, 0))));

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

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

            _orSetService.Merge(new List <OUR_SetWithVCElement <TestType> > {
                element
            }.ToImmutableHashSet(), ImmutableHashSet <OUR_SetWithVCElement <TestType> > .Empty);

            var repositoryValues = _repository.GetAdds();

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