public Worker( ILogger <Worker> logger, IServiceProvider serviceProvider, INotificationQueueService notificationQueueService, IConfiguration configuration) { _logger = logger; _serviceProvider = serviceProvider; _notificationQueueService = notificationQueueService; _handlers = new List <IMessageHandler>(); _handlers.Add(new Admin(serviceProvider)); _handlers.Add(new Stats(serviceProvider)); _handlers.Add(new Connect(serviceProvider)); _handlers.Add(new Disconnect(serviceProvider)); _handlers.Add(new Subscribe(serviceProvider)); _handlers.Add(new Help(serviceProvider)); _handlers.Add(new Fuel(serviceProvider)); _handlers.Add(new FuelDebug(serviceProvider)); _handlers.Add(new Ration(serviceProvider)); _handlers.Add(new Campaign(serviceProvider)); _discordClientKey = configuration.GetValue <string>("DiscordClientKey"); _discordGreetingChannels = System.Text.Json.JsonSerializer.Deserialize <Dictionary <string, ulong> >( configuration.GetValue <string>("GreetingChannelIds") ).ToList().ToDictionary(kv => ulong.Parse(kv.Key), kv => kv.Value); }
public void Initialize() { log = NullLoggerFactory.Instance.CreateLogger("Dummy"); sub = new PushSubscriptionInformation(); sub.EndPoint = "https://dummy_endpoint"; sub.ExpirationTime = null; sub.Keys = new Keys(); sub.Keys.Authentication = "dummy_authentication"; sub.Keys.p256dh = "dummy_p256dh"; Environment.SetEnvironmentVariable("DatabaseId", TestContext.Properties["DatabaseId"].ToString(), EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("CollectionId", TestContext.Properties["CollectionId"].ToString(), EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("AzureWebJobsStorage", TestContext.Properties["AzureWebJobsStorage"].ToString(), EnvironmentVariableTarget.Process); client = new DocumentClient(new Uri(TestContext.Properties["AccountEndpoint"].ToString()), TestContext.Properties["AccountKey"].ToString()); notificationQueueService = new NotificationQueueService(); subscriptionService = new SubscriptionService(notificationQueueService); subscriptionTriggerSubscribe = new SubscriptionTriggerSubscribe(subscriptionService); }
public SubscriptionService(INotificationQueueService notificationQueueService) { this.notificationQueueService = notificationQueueService; }