public void MergeAdds_IsCommutative() { var firstValue = _builder.Build(); var secondValue = _builder.Build(); var thirdValue = _builder.Build(); var fourthValue = _builder.Build(); var fifthValue = _builder.Build(); var firstRepository = new P_SetRepository(); var firstService = new P_SetService <TestType>(firstRepository); _repository.PersistAdds(new HashSet <TestType> { firstValue, secondValue, thirdValue }.ToImmutableHashSet()); firstService.Merge(new HashSet <TestType> { fourthValue, fifthValue }.ToImmutableHashSet(), ImmutableHashSet <TestType> .Empty); var firstRepositoryValues = firstRepository.GetAdds(); var secondRepository = new P_SetRepository(); var secondService = new P_SetService <TestType>(secondRepository); _repository.PersistAdds(new HashSet <TestType> { fourthValue, fifthValue }.ToImmutableHashSet()); secondService.Merge(new HashSet <TestType> { firstValue, secondValue, thirdValue }.ToImmutableHashSet(), ImmutableHashSet <TestType> .Empty); var secondRepositoryValues = firstRepository.GetAdds(); Assert.Equal(firstRepositoryValues, secondRepositoryValues); }
private Dictionary <Node, P_SetService <TestType> > CreateConvergentReplicas(List <Node> nodes) { var dictionary = new Dictionary <Node, P_SetService <TestType> >(); foreach (var node in nodes) { var repository = new P_SetRepository(); var service = new P_SetService <TestType>(repository); dictionary.Add(node, service); } return(dictionary); }
public P_SetServiceTests() { _repository = new P_SetRepository(); _pSetService = new P_SetService <TestType>(_repository); }
public P_SetServiceTests() { _repository = new P_SetRepository(); _pSetService = new P_SetService <TestType>(_repository); _builder = new TestTypeBuilder(new Random()); }