示例#1
0
        public async Task Enable_then_Disable_should_subscribe_and_unsubscribe()
        {
            var bus     = new FakeBus();
            var pattern = new PatternBuilder("root").Build();

            using var subscription = new AsyncActionSubscription(bus, pattern, e => Task.CompletedTask);

            await subscription.EnableAsync().ConfigureAwait(false);

            Assert.True(bus.IsSubscribed(subscription));

            await subscription.DisableAsync().ConfigureAwait(false);

            Assert.False(bus.IsSubscribed(subscription));
        }