public static EventProcessingConfigContext Create(long partitionId, out IdGenerator idGenerator)
        {
            EventProcessingConfigContext repo = new EventProcessingConfigContext();

            idGenerator = new IdGenerator();

            AddHarry(partitionId, idGenerator, repo);
            AddGeorge(partitionId, idGenerator, repo);
            AddNosey(partitionId, idGenerator, repo);
            AddIan(partitionId, idGenerator, repo);
            AddEric(partitionId, idGenerator, repo);
            AddCharlie(partitionId, idGenerator, repo);
            AddMary(partitionId, idGenerator, repo);

            return(repo);
        }
        public static void AddMary(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var subscriber = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "Mary",
                PartitionId = partitionId
            });

            var queue = repo.Add(new SubscriberQueueDto
            {
                Id           = id.Next <SubscriberQueueDto>(),
                SubscriberId = subscriber.Id,
                Name         = "subscriber-mary"
            });

            var standardContract = repo.Add(
                new SubscriberContractDto
            {
                Id           = id.Next <SubscriberContractDto>(),
                SubscriberId = subscriber.Id,
                Name         = "StandardContract",
                Abi          = StandardContractAbi
            });

            var anyEventSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id                     = id.Next <EventSubscriptionDto>(),
                SubscriberId           = subscriber.Id,
                ContractId             = standardContract.Id,
                CatchAllContractEvents = true
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = anyEventSubscription.Id,
                HandlerType         = EventHandlerType.Queue,
                Order             = 1,
                SubscriberQueueId = queue.Id
            });
        }
        public static void AddCharlie(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var subscriber = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "Charlie",
                PartitionId = partitionId
            });

            var repository = repo.Add(new SubscriberStorageDto
            {
                Id           = id.Next <SubscriberStorageDto>(),
                SubscriberId = subscriber.Id,
                Name         = "charlielogs"
            });

            var contract = repo.Add(new SubscriberContractDto
            {
                Id           = id.Next <SubscriberContractDto>(),
                SubscriberId = subscriber.Id,
                Abi          = StandardContractAbi,
                Name         = "StandardContract"
            });

            var catchAllSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id              = id.Next <EventSubscriptionDto>(),
                SubscriberId    = subscriber.Id,
                ContractId      = contract.Id,
                EventSignatures = new List <string>(new [] { TransferEventSignature })
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAllSubscription.Id,
                HandlerType         = EventHandlerType.Store,
                Order = 1,
                SubscriberRepositoryId = repository.Id
            });
        }
        public static void AddIan(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var indexer = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "Ian",
                PartitionId = partitionId
            });

            var searchIndex = repo.Add(new SubscriberSearchIndexDto
            {
                Id           = id.Next <SubscriberSearchIndexDto>(),
                SubscriberId = indexer.Id,
                Name         = "subscriber-transfer-ian"
            });

            var contract = repo.Add(new SubscriberContractDto
            {
                Id           = id.Next <SubscriberContractDto>(),
                SubscriberId = indexer.Id,
                Abi          = StandardContractAbi,
                Name         = "StandardContract"
            });

            var catchAllSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id              = id.Next <EventSubscriptionDto>(),
                SubscriberId    = indexer.Id,
                ContractId      = contract.Id,
                EventSignatures = new List <string>(new [] { TransferEventSignature })
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAllSubscription.Id,
                HandlerType         = EventHandlerType.Index,
                Order = 2,
                SubscriberSearchIndexId = searchIndex.Id
            });
        }
예제 #5
0
        private async Task ClearDown(
            EventProcessingConfigContext repo,
            AzureTablesRepositoryFactory cloudTableSetup,
            IAzureSearchService searchService,
            AzureStorageQueueFactory subscriberQueueFactory,
            AzureTablesSubscriberRepositoryFactory azureTablesSubscriberRepositoryFactory)
        {
            foreach (var index in repo.SubscriberSearchIndexes)
            {
                await searchService.DeleteIndexAsync(index.Name);
            }

            foreach (var queue in repo.SubscriberSearchIndexes)
            {
                await subscriberQueueFactory.DeleteQueueAsync(queue.Name);
            }

            await cloudTableSetup.GetCountersTable().DeleteIfExistsAsync();

            await azureTablesSubscriberRepositoryFactory.DeleteTablesAsync();
        }
        public static IEventProcessingConfigurationRepository CreateMockRepository(this EventProcessingConfigContext repo, IdGenerator id)
        {
            Mock <IEventProcessingConfigurationRepository> configDb = new Mock <IEventProcessingConfigurationRepository>();

            var EventSubscriptionStateRepository          = new Mock <IEventSubscriptionStateRepository>();
            var EventContractQueryConfigurationRepository = new Mock <IEventContractQueryConfigurationRepository>();

            var EventHandlerHistory                  = new Mock <IEventHandlerHistoryRepository>();
            var EventAggregatorRepository            = new Mock <IEventAggregatorRepository>();
            var EventRuleRepository                  = new Mock <IEventRuleRepository>();
            var subscriberStorageRepository          = new Mock <ISubscriberStorageRepository>();
            var subscriberRepository                 = new Mock <ISubscriberRepository>();
            var subscriberQueueRepository            = new Mock <ISubscriberQueueRepository>();
            var subscriberSearchIndexRepository      = new Mock <ISubscriberSearchIndexRepository>();
            var subscriberContractRepository         = new Mock <ISubscriberContractRepository>();
            var eventSubscriptionRepository          = new Mock <IEventSubscriptionRepository>();
            var eventSubscriptionAddressesRepository = new Mock <IEventSubscriptionAddressRepository>();
            var parameterConditionsRepository        = new Mock <IParameterConditionRepository>();
            var eventHandlerRepository               = new Mock <IEventHandlerRepository>();

            configDb.Setup(c => c.EventSubscriptionStates).Returns(EventSubscriptionStateRepository.Object);
            configDb.Setup(c => c.EventContractQueries).Returns(EventContractQueryConfigurationRepository.Object);
            configDb.Setup(c => c.EventAggregators).Returns(EventAggregatorRepository.Object);
            configDb.Setup(c => c.EventHandlerHistoryRepo).Returns(EventHandlerHistory.Object);
            configDb.Setup(c => c.EventRules).Returns(EventRuleRepository.Object);
            configDb.Setup(c => c.SubscriberStorage).Returns(subscriberStorageRepository.Object);
            configDb.Setup(c => c.SubscriberSearchIndexes).Returns(subscriberSearchIndexRepository.Object);

            configDb.Setup(c => c.Subscribers).Returns(subscriberRepository.Object);
            configDb.Setup(c => c.EventSubscriptions).Returns(eventSubscriptionRepository.Object);
            configDb.Setup(c => c.SubscriberContracts).Returns(subscriberContractRepository.Object);
            configDb.Setup(c => c.SubscriberQueues).Returns(subscriberQueueRepository.Object);
            configDb.Setup(c => c.EventSubscriptionAddresses).Returns(eventSubscriptionAddressesRepository.Object);
            configDb.Setup(c => c.ParameterConditions).Returns(parameterConditionsRepository.Object);
            configDb.Setup(c => c.EventHandlers).Returns(eventHandlerRepository.Object);

            EventHandlerHistory.Setup(h => h.UpsertAsync(It.IsAny <IEventHandlerHistoryDto>()))
            .Returns <IEventHandlerHistoryDto>((history) =>
            {
                repo.Add(history);
                return(Task.FromResult(history));
            });

            EventHandlerHistory.Setup(h => h.ContainsAsync(It.IsAny <long>(), It.IsAny <string>()))
            .Returns <long, string>((eventHandlerId, eventKey) =>
            {
                var exists = repo.EventHandlerHistories.Any(h =>
                                                            h.EventHandlerId == eventHandlerId &&
                                                            h.EventKey == eventKey);

                return(Task.FromResult(exists));
            });

            subscriberRepository
            .Setup(d => d.GetManyAsync(It.IsAny <long>()))
            .Returns <long>((partitionId) => Task.FromResult(repo.Subscribers.Where(s => s.PartitionId == partitionId).Cast <ISubscriberDto>().ToArray()));

            eventSubscriptionRepository
            .Setup(d => d.GetManyAsync(It.IsAny <long>()))
            .Returns <long>((subscriberId) => Task.FromResult(repo.EventSubscriptions.Where(s => s.SubscriberId == subscriberId).Cast <IEventSubscriptionDto>().ToArray()));

            subscriberContractRepository
            .Setup(d => d.GetAsync(It.IsAny <long>(), It.IsAny <long>()))
            .Returns <long, long>((subscriberId, contractId) => Task.FromResult(repo.Contracts.Where(s => s.SubscriberId == subscriberId && s.Id == contractId).Cast <ISubscriberContractDto>().FirstOrDefault()));

            eventSubscriptionAddressesRepository
            .Setup(d => d.GetManyAsync(It.IsAny <long>()))
            .Returns <long>((eventSubscriptionId) => Task.FromResult(repo.EventSubscriptionAddresses.Where(s => s.EventSubscriptionId == eventSubscriptionId).Cast <IEventSubscriptionAddressDto>().ToArray()));

            parameterConditionsRepository
            .Setup(d => d.GetManyAsync(It.IsAny <long>()))
            .Returns <long>((eventSubscriptionId) => Task.FromResult(repo.ParameterConditions.Where(s => s.EventSubscriptionId == eventSubscriptionId).Cast <IParameterConditionDto>().ToArray()));

            eventHandlerRepository
            .Setup(d => d.GetManyAsync(It.IsAny <long>()))
            .Returns <long>((eventSubscriptionId) => Task.FromResult(repo.DecodedEventHandlers.Where(s => s.EventSubscriptionId == eventSubscriptionId).Cast <IEventHandlerDto>().ToArray()));

            EventSubscriptionStateRepository
            .Setup(d => d.GetAsync(It.IsAny <long>()))
            .Returns <long>((eventSubscriptionId) =>
            {
                var state = repo.GetEventSubscriptionState(eventSubscriptionId);
                if (state == null)
                {
                    state = repo.Add(new EventSubscriptionStateDto(eventSubscriptionId));
                }
                return(Task.FromResult(state as IEventSubscriptionStateDto));
            });

            EventSubscriptionStateRepository
            .Setup(d => d.UpsertAsync(It.IsAny <IEnumerable <IEventSubscriptionStateDto> >()))
            .Callback <IEnumerable <IEventSubscriptionStateDto> >((states) =>
            {
                foreach (var state in states)
                {
                    //simulate an update
                    //this is in memory so not really representative
                    var existing = repo.EventSubscriptionStates.FirstOrDefault(s => s.EventSubscriptionId == state.EventSubscriptionId);
                    var index    = repo.EventSubscriptionStates.IndexOf(existing);
                    repo.EventSubscriptionStates[index] = state;
                }
            })
            .Returns(Task.CompletedTask);

            EventContractQueryConfigurationRepository
            .Setup(d => d.GetAsync(It.IsAny <long>(), It.IsAny <long>()))
            .Returns <long, long>((subscriberId, eventHandlerId) =>
            {
                var contractQuery = repo.ContractQueries.FirstOrDefault(c => c.EventHandlerId == eventHandlerId);
                if (contractQuery == null)
                {
                    throw new ArgumentException($"Could not find Contract Query Configuration for Event Handler Id: {eventHandlerId}");
                }
                var contract = repo.Contracts.FirstOrDefault(c => c.SubscriberId == subscriberId && c.Id == contractQuery.ContractId);
                if (contract == null)
                {
                    throw new ArgumentException($"Could not find Contract Query Id: {contractQuery.Id}, Contract Id: {contractQuery.ContractId}");
                }
                var parameters = repo.ContractQueryParameters.Where(p => p.ContractQueryId == contractQuery.Id);

                ContractQueryConfiguration config = Map(contractQuery, contract, parameters);

                return(Task.FromResult(config));
            });

            EventAggregatorRepository
            .Setup(d => d.GetAsync(It.IsAny <long>()))
            .Returns <long>((eventHandlerId) =>
            {
                var dto = repo.EventAggregators.FirstOrDefault(c => c.EventHandlerId == eventHandlerId);
                if (dto == null)
                {
                    throw new ArgumentException($"Could not find Event Aggregator Configuration for Event Handler Id: {eventHandlerId}");
                }
                return(Task.FromResult(dto as IEventAggregatorDto));
            });

            subscriberQueueRepository
            .Setup(d => d.GetAsync(It.IsAny <long>(), It.IsAny <long>()))
            .Returns <long, long>((subscriberId, subscriberQueueId) =>
            {
                var dto = repo.SubscriberQueues.FirstOrDefault(q => q.SubscriberId == subscriberId && q.Id == subscriberQueueId);
                if (dto == null)
                {
                    throw new ArgumentException($"Could not find Subscriber Queue Id: {subscriberQueueId}");
                }
                return(Task.FromResult(dto as ISubscriberQueueDto));
            });

            subscriberSearchIndexRepository
            .Setup(d => d.GetAsync(It.IsAny <long>(), It.IsAny <long>()))
            .Returns <long, long>((subscriberId, subscriberSearchIndexId) => {
                var dto = repo.SubscriberSearchIndexes.FirstOrDefault(q => q.SubscriberId == subscriberId && q.Id == subscriberSearchIndexId);
                if (dto == null)
                {
                    throw new ArgumentException($"Could not find Subscriber Search Index Id: {subscriberSearchIndexId}");
                }
                return(Task.FromResult(dto as ISubscriberSearchIndexDto));
            });

            subscriberStorageRepository
            .Setup(d => d.GetAsync(It.IsAny <long>(), It.IsAny <long>()))
            .Returns <long, long>((subscriberId, subscriberRepositoryId) => {
                var dto = repo.SubscriberRepositories.FirstOrDefault(q => q.SubscriberId == subscriberId && q.Id == subscriberRepositoryId);
                if (dto == null)
                {
                    throw new ArgumentException($"Could not find Subscriber Repository Id: {subscriberRepositoryId}");
                }
                return(Task.FromResult(dto as ISubscriberStorageDto));
            });

            EventRuleRepository
            .Setup(d => d.GetAsync(It.IsAny <long>()))
            .Returns <long>((eventHandlerId) =>
            {
                var dto = repo.EventRuleConfigurations.FirstOrDefault(c => c.EventHandlerId == eventHandlerId);
                if (dto == null)
                {
                    throw new ArgumentException($"Could not find EventRuleConfiguration for Event Handler Id: {eventHandlerId}");
                }
                return(Task.FromResult(Map(dto)));
            });


            return(configDb.Object);
        }
        public static void AddHarry(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var subscriber = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "Harry",
                PartitionId = partitionId
            });

            var queue = repo.Add(new SubscriberQueueDto
            {
                Id           = id.Next <SubscriberQueueDto>(),
                SubscriberId = subscriber.Id,
                Name         = "subscriber-harry"
            });

            var standardContract = repo.Add(
                new SubscriberContractDto
            {
                Id           = id.Next <SubscriberContractDto>(),
                SubscriberId = subscriber.Id,
                Name         = "StandardContract",
                Abi          = StandardContractAbi
            });

            var transferSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id              = id.Next <EventSubscriptionDto>(),
                SubscriberId    = subscriber.Id,
                ContractId      = standardContract.Id,
                EventSignatures = new List <string>(new[] { TransferEventSignature })
            });

            var getTransactionHandler = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferSubscription.Id,
                HandlerType         = EventHandlerType.GetTransaction,
                Order = 0
            });

            var transferValueRunningTotalHandler = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferSubscription.Id,
                HandlerType         = EventHandlerType.Aggregate,
                Order = 1
            });

            repo.Add(new EventAggregatorDto
            {
                Id                   = id.Next <EventAggregatorDto>(),
                EventHandlerId       = transferValueRunningTotalHandler.Id,
                Destination          = AggregatorDestination.EventSubscriptionState,
                Operation            = AggregatorOperation.Sum,
                Source               = AggregatorSource.EventParameter,
                EventParameterNumber = 3,
                OutputKey            = "RunningTotalForTransferValue"
            });

            var getTokenHandler = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferSubscription.Id,
                HandlerType         = EventHandlerType.ContractQuery,
                Order = 2
            });

            repo.Add(new ContractQueryDto
            {
                Id                    = id.Next <ContractQueryDto>(),
                EventHandlerId        = getTokenHandler.Id,
                ContractId            = standardContract.Id,
                ContractAddressSource = ContractAddressSource.EventAddress,
                EventStateOutputName  = "TokenName",
                FunctionSignature     = "06fdde03" // name
            });

            var getBalanceHandler = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferSubscription.Id,
                HandlerType         = EventHandlerType.ContractQuery,
                Order = 3
            });

            var getBalanceQuery = repo.Add(new ContractQueryDto
            {
                Id                    = id.Next <ContractQueryDto>(),
                EventHandlerId        = getBalanceHandler.Id,
                ContractId            = 1,
                ContractAddressSource = ContractAddressSource.EventAddress,
                EventStateOutputName  = "FromAddressCurrentBalance",
                FunctionSignature     = "70a08231" // balanceOf
            });

            repo.Add(new ContractQueryParameterDto
            {
                Id = id.Next <ContractQueryParameterDto>(),
                ContractQueryId      = getBalanceQuery.Id,
                Order                = 1,
                Source               = EventValueSource.EventParameters,
                EventParameterNumber = 1
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferSubscription.Id,
                HandlerType         = EventHandlerType.Queue,
                Order             = 4,
                SubscriberQueueId = queue.Id
            });
        }
        public static void AddGeorge(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var subscriber = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "George",
                PartitionId = partitionId
            });

            var queue = repo.Add(new SubscriberQueueDto
            {
                Id           = id.Next <SubscriberQueueDto>(),
                SubscriberId = subscriber.Id,
                Name         = "subscriber-george"
            });

            var standardContract = repo.Add(
                new SubscriberContractDto
            {
                Id           = id.Next <SubscriberContractDto>(),
                SubscriberId = subscriber.Id,
                Name         = "StandardContract",
                Abi          = StandardContractAbi
            });

            var transferEventSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id              = id.Next <EventSubscriptionDto>(),
                SubscriberId    = subscriber.Id,
                ContractId      = standardContract.Id,
                EventSignatures = new List <string>(new[] { TransferEventSignature })
            });

            var transferCountHandler = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferEventSubscription.Id,
                HandlerType         = EventHandlerType.Aggregate,
                Order = 1
            });

            repo.Add(new EventAggregatorDto
            {
                Id             = id.Next <EventAggregatorDto>(),
                EventHandlerId = transferCountHandler.Id,
                Destination    = AggregatorDestination.EventSubscriptionState,
                Operation      = AggregatorOperation.Count,
                OutputKey      = "CurrentTransferCount"
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = transferEventSubscription.Id,
                HandlerType         = EventHandlerType.Queue,
                Order             = 2,
                SubscriberQueueId = queue.Id
            });
        }
        public static void AddNosey(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var subscriber = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "Nosey",
                PartitionId = partitionId
            });

            var queue = repo.Add(new SubscriberQueueDto
            {
                Id           = id.Next <SubscriberQueueDto>(),
                SubscriberId = subscriber.Id,
                Name         = "subscriber-nosey"
            });

            var catchAnyEventForAddressSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id           = id.Next <EventSubscriptionDto>(),
                SubscriberId = subscriber.Id
            });

            repo.Add(new EventSubscriptionAddressDto {
                Id = id.Next <EventSubscriptionAddressDto>(),
                EventSubscriptionId = catchAnyEventForAddressSubscription.Id,
                Address             = "0x924442a66cfd812308791872c4b242440c108e19"
            });

            var txHashTracker = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAnyEventForAddressSubscription.Id,
                HandlerType         = EventHandlerType.Aggregate,
                Order = 1
            });

            repo.Add(new EventAggregatorDto
            {
                EventHandlerId = txHashTracker.Id,
                Source         = AggregatorSource.TransactionHash,
                Destination    = AggregatorDestination.EventSubscriptionState,
                OutputKey      = "AllTransactionHashes",
                Operation      = AggregatorOperation.AddToList
            });

            var blockTracker = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAnyEventForAddressSubscription.Id,
                HandlerType         = EventHandlerType.Aggregate,
                Order = 2
            });

            repo.Add(new EventAggregatorDto
            {
                EventHandlerId = blockTracker.Id,
                Source         = AggregatorSource.BlockNumber,
                Destination    = AggregatorDestination.EventSubscriptionState,
                OutputKey      = "AllBlockNumbers",
                Operation      = AggregatorOperation.AddToList
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAnyEventForAddressSubscription.Id,
                HandlerType         = EventHandlerType.Queue,
                Order             = 2,
                SubscriberQueueId = queue.Id
            });
        }
        public static void AddEric(long partitionId, IdGenerator id, EventProcessingConfigContext repo)
        {
            var subscriber = repo.Add(new SubscriberDto
            {
                Id          = id.Next <SubscriberDto>(),
                Disabled    = false,
                Name        = "Eric",
                PartitionId = partitionId
            });

            var contract = repo.Add(new SubscriberContractDto
            {
                Id           = id.Next <SubscriberContractDto>(),
                SubscriberId = subscriber.Id,
                Abi          = StandardContractAbi,
                Name         = "StandardContract"
            });

            var catchAllTransfersSubscription = repo.Add(
                new EventSubscriptionDto
            {
                Id              = id.Next <EventSubscriptionDto>(),
                SubscriberId    = subscriber.Id,
                ContractId      = contract.Id,
                EventSignatures = new List <string>(new [] { TransferEventSignature })
            });

            var ruleHandler = repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAllTransfersSubscription.Id,
                HandlerType         = EventHandlerType.Rule,
                Order = 1
            });

            repo.Add(new EventRuleConfigurationDto
            {
                Id             = id.Next <EventRuleConfigurationDto>(),
                EventHandlerId = ruleHandler.Id,
                Type           = EventRuleType.Modulus,
                Source         = EventRuleSource.EventSubscriptionState,
                SourceKey      = "EventsHandled",
                Value          = "10"
            });

            var queue = repo.Add(new SubscriberQueueDto
            {
                Id           = id.Next <SubscriberQueueDto>(),
                SubscriberId = subscriber.Id,
                Name         = "subscriber-transfer-eric"
            });

            repo.Add(new EventHandlerDto
            {
                Id = id.Next <EventHandlerDto>(),
                EventSubscriptionId = catchAllTransfersSubscription.Id,
                HandlerType         = EventHandlerType.Queue,
                Order             = 2,
                SubscriberQueueId = queue.Id
            });
        }