예제 #1
0
        public void ShouldClearSubscriptionsForGivenMessage()
        {
            var coursier = new Coursier();

            MakeABunchOfSubscriptions(coursier);

            coursier.ClearSubscriptionsFor <TestMessageTwo>();

            Assert.Equal(3, coursier.SubscriptionCount <TestMessageOne>());
            Assert.Equal(0, coursier.SubscriptionCount <TestMessageTwo>());
        }
예제 #2
0
        public void ShouldKeepCountOfSubscriptions()
        {
            var coursier = new Coursier();

            var subOne = coursier.Subscribe <TestMessageOne>(msg => { });

            coursier.Subscribe <TestMessageOne>(msg => { });

            Assert.Equal(2, coursier.SubscriptionCount <TestMessageOne>());

            coursier.Unsubscribe <TestMessageOne>(subOne);

            Assert.Equal(1, coursier.SubscriptionCount <TestMessageOne>());
        }