예제 #1
0
    public void Duplicates_should_not_be_generated_for_interface_inheritance_chains()
    {
        using (var store = DocumentStoreBuilder.Build())
        {
            var storage = new SubscriptionPersister
            {
                DocumentStore = store
            };

            storage.Init();
            storage.Subscribe(TestClients.ClientA, new[]
            {
                new MessageType(typeof(ISomeInterface))
            });
            storage.Subscribe(TestClients.ClientA, new[]
            {
                new MessageType(typeof(ISomeInterface2))
            });
            storage.Subscribe(TestClients.ClientA, new[]
            {
                new MessageType(typeof(ISomeInterface3))
            });

            var subscriptionsForMessageType = storage.GetSubscriberAddressesForMessage(new[]
            {
                new MessageType(typeof(ISomeInterface)),
                new MessageType(typeof(ISomeInterface2)),
                new MessageType(typeof(ISomeInterface3))
            });

            Assert.AreEqual(1, subscriptionsForMessageType.Count());
        }
    }
    public void No_subscribers_should_be_returned()
    {
        using (var store = DocumentStoreBuilder.Build())
        {
            var storage = new SubscriptionPersister
            {
                DocumentStore = store
            };

            storage.Init();
            var subscriptionsForMessageType = storage.GetSubscriberAddressesForMessage(MessageTypes.MessageA);

            Assert.AreEqual(0, subscriptionsForMessageType.Count());
        }
    }
 protected override Task OnStart(IMessageSession session)
 {
     return(persister.Init());
 }
예제 #4
0
 protected override Task OnStart(IMessageSession session)
 {
     persister.Init();
     return(Task.FromResult(0));
 }