public void Dispose() { var d = default(IDisposable); var us = new MonocastSubject <int>(); var o = us.Cache(capacityHint: 16, cancel: v => d = v); Assert.IsNull(d); Assert.False(us.HasObserver()); var to = o.Test(); Assert.IsNotNull(d); Assert.True(us.HasObserver()); d.Dispose(); Assert.False(us.HasObserver()); to.AssertFailure(typeof(OperationCanceledException)); }