public void calling_disposer_raises_disposed_evt() { var disposeCalled = false; IDisposableSubscription sub = new DisposableSubscription(null); sub.Disposed += (s, e) => disposeCalled = true; sub.GetDisposer().Dispose(); disposeCalled.ShouldBeTrue(); }
public void Adapter_subscriptions_can_also_be_disposed() { var b = new MethodScanner("Handle").MakeBuilder(); var disposableSub = new DisposableSubscription(b.BuildSubscriptions(new SomeHandler()).First()); ISubscriptionResolver resolver = new CompositeSubscription(); resolver.Add(disposableSub); var subs = resolver.GetSubscriptionsFor(new MessageA()); subs.ShouldHaveCount(1); disposableSub.GetDisposer().Dispose(); subs = resolver.GetSubscriptionsFor(new MessageA()); subs.ShouldHaveCount(0); }