public void Merge_IsCommutative() { var firstValue = _builder.Build(); var secondValue = _builder.Build(); var thirdValue = _builder.Build(); var fourthValue = _builder.Build(); var fifthValue = _builder.Build(); var firstRepository = new G_SetRepository(); var firstService = new G_SetService <TestType>(firstRepository); firstRepository.PersistValues(new HashSet <TestType> { firstValue, secondValue, thirdValue }.ToImmutableHashSet()); firstService.Merge(new HashSet <TestType> { fourthValue, fifthValue }.ToImmutableHashSet()); var firstRepositoryValues = firstRepository.GetValues(); var secondRepository = new G_SetRepository(); var secondService = new G_SetService <TestType>(secondRepository); secondRepository.PersistValues(new HashSet <TestType> { fourthValue, fifthValue }.ToImmutableHashSet()); secondService.Merge(new HashSet <TestType> { firstValue, secondValue, thirdValue }.ToImmutableHashSet()); var secondRepositoryValues = firstRepository.GetValues(); Assert.Equal(firstRepositoryValues, secondRepositoryValues); }
private Dictionary <Node, CRDT.Application.Convergent.Set.G_SetService <TestType> > CreateConvergentReplicas(List <Node> nodes) { var dictionary = new Dictionary <Node, CRDT.Application.Convergent.Set.G_SetService <TestType> >(); foreach (var node in nodes) { var repository = new G_SetRepository(); var service = new CRDT.Application.Convergent.Set.G_SetService <TestType>(repository); dictionary.Add(node, service); } return(dictionary); }
private Dictionary <Node, G_SetService <TestType> > CreateCommutativeReplicas(List <Node> nodes) { var dictionary = new Dictionary <Node, G_SetService <TestType> >(); foreach (var node in nodes) { var repository = new G_SetRepository(); var service = new G_SetService <TestType>(repository); dictionary.Add(node, service); } return(dictionary); }