public void MergeRemoves_IsCommutative(Guid firstTag, Guid secondTag, Node node) { var clock = ImmutableSortedDictionary <Node, long> .Empty; var firstElement = new OUR_SetWithVCElement <TestType>(_builder.Build(), firstTag, new VectorClock(clock.Add(node, 0))); var secondElement = new OUR_SetWithVCElement <TestType>(_builder.Build(), secondTag, new VectorClock(clock.Add(node, 0))); var thirdElement = new OUR_SetWithVCElement <TestType>(_builder.Build(), secondTag, new VectorClock(clock.Add(node, 0))); var fourthElement = new OUR_SetWithVCElement <TestType>(_builder.Build(), firstTag, new VectorClock(clock.Add(node, 0))); var fifthElement = new OUR_SetWithVCElement <TestType>(_builder.Build(), firstTag, new VectorClock(clock.Add(node, 0))); var firstRepository = new OUR_SetWithVCRepository(); var firstService = new OUR_SetWithVCService <TestType>(firstRepository); firstRepository.PersistRemoves(new List <OUR_SetWithVCElement <TestType> > { firstElement, secondElement, thirdElement }.ToImmutableHashSet()); firstRepository.PersistAdds(new List <OUR_SetWithVCElement <TestType> > { fourthElement, fifthElement }.ToImmutableHashSet()); firstService.Merge(ImmutableHashSet <OUR_SetWithVCElement <TestType> > .Empty, new List <OUR_SetWithVCElement <TestType> > { fourthElement, fifthElement }.ToImmutableHashSet()); var firstRepositoryValues = firstRepository.GetRemoves(); var secondRepository = new OUR_SetWithVCRepository(); var secondService = new OUR_SetWithVCService <TestType>(secondRepository); secondRepository.PersistRemoves(new List <OUR_SetWithVCElement <TestType> > { fourthElement, fifthElement }.ToImmutableHashSet()); secondRepository.PersistAdds(new List <OUR_SetWithVCElement <TestType> > { firstElement, secondElement, thirdElement }.ToImmutableHashSet()); secondService.Merge(ImmutableHashSet <OUR_SetWithVCElement <TestType> > .Empty, new List <OUR_SetWithVCElement <TestType> > { firstElement, secondElement, thirdElement }.ToImmutableHashSet()); var secondRepositoryValues = firstRepository.GetRemoves(); Assert.Equal(firstRepositoryValues, secondRepositoryValues); }
public OUR_SetWithVCServiceTests() { _repository = new OUR_SetWithVCRepository(); _ourSetService = new OUR_SetWithVCService <TestType>(_repository); _builder = new TestTypeBuilder(new Random()); }