public void Subscriptions_are_built_for_object_method_based()
 {
     var builder = new MethodBasedBuilder("Handle");
     var subs = builder.BuildSubscriptions(new SomeHandler());
     subs.ShouldNotBeNull();
     subs.ShouldHaveCount(1);
 }
 public void Subscriptions_for_object_method_based_work_correctly()
 {
     var builder = new MethodBasedBuilder("Handle");
     var handler = new SomeHandler();
     var subs = builder.BuildSubscriptions(handler);
     var subscription = subs.First();
     subscription.Handles(typeof(MessageA)).ShouldBeTrue();
     subscription.Push(new MessageA());
     handler.MsgACalls.ShouldBeEqualTo(1);
 }
        public void Adapter_subscriptions_can_also_be_disposed()
        {
            var b = new MethodBasedBuilder("Handle");
            var disposableSub = new DisposableSubscription(b.BuildSubscriptions(new SomeHandler()).First());
            var resolver = new StandardResolver();
            resolver.Add(disposableSub);

            var subs = resolver.GetSubscriptionsFor(new MessageA());
            subs.ShouldHaveCount(1);

            disposableSub.GetDisposer().Dispose();

            subs = resolver.GetSubscriptionsFor(new MessageA());
            subs.ShouldHaveCount(0);
        }