public async Task GetSubscribers_supports_polymorphism() { var settings = new AzureStorageAddressingSettings(new QueueAddressGenerator(s => s), "default", table.Name, new Dictionary <string, AccountInfo>(), new AccountInfo("", queueServiceClient, cloudTableClient)); var subscriptionStore = new SubscriptionStore(settings); await subscriptionStore.Subscribe("subscriberEndpoint", "subscriberAddress", typeof(MyEvent)); var subcribers = await subscriptionStore.GetSubscribers(typeof(MyOtherEvent)); CollectionAssert.AreEqual(new[] { "subscriberAddress" }, subcribers); }
public async Task GetSubscribers_with_mapped_events() { var settings = new AzureStorageAddressingSettings(new QueueAddressGenerator(s => s), "subscriber", table.Name, new Dictionary <string, AccountInfo>(), new AccountInfo("", queueServiceClient, cloudTableClient)); var publisherAccount = new AccountInfo("publisher", queueServiceClient, cloudTableClient); publisherAccount.AddEndpoint("publisherEndpoint", new[] { typeof(MyEventPublishedOnAnotherAccount) }, subscriptionTableName: table.Name); settings.Add(publisherAccount); var subscriptionStore = new SubscriptionStore(settings); await subscriptionStore.Subscribe("subscriberEndpoint", "subscriberAddress", typeof(MyOtherEvent)); await subscriptionStore.Subscribe("subscriberEndpoint", "subscriberAddress", typeof(MyOtherUnrelatedEvent)); await subscriptionStore.Subscribe("subscriberEndpoint", "subscriberAddress", typeof(MyEventPublishedOnAnotherAccount)); var subcribers = await subscriptionStore.GetSubscribers(typeof(MyEventPublishedOnAnotherAccount)); CollectionAssert.AreEqual(new[] { "subscriberAddress@subscriber" }, subcribers); }