private async Task AddEventHandlers(EventSubscription eventSubscription) { var handlerConfiguration = await ConfigurationRepository.EventHandlers.GetManyAsync(eventSubscription.Id).ConfigureAwait(false); foreach (var configItem in handlerConfiguration.Where(c => !c.Disabled).OrderBy(h => h.Order)) { eventSubscription.AddHandler(await EventHandlerFactory.LoadAsync(eventSubscription, configItem).ConfigureAwait(false)); } }
public async Task EventRule() { var config = new EventHandlerDto { Id = 50, EventSubscriptionId = 99, HandlerType = EventHandlerType.Rule }; var handler = await _eventHandlerFactory.LoadAsync(_mockEventSubscription.Object, config); var eventRuleHandler = handler as EventRule; Assert.NotNull(eventRuleHandler); Assert.Equal(config.Id, eventRuleHandler.Id); Assert.Same(_mockEventSubscription.Object, eventRuleHandler.Subscription); }