public void Decrement_should_not_call_dispose_when_reference_count_is_greater_than_zero()
        {
            var subject = new ReferenceCounted <IDisposable>(_disposable);

            subject.IncrementReferenceCount();
            subject.DecrementReferenceCount();

            subject.ReferenceCount.Should().Be(1);
            _disposable.DidNotReceive().Dispose();
        }
示例#2
0
        public void Should_dispose_fsWatcher_after_unsubscription()
        {
            var watcher = CreateFileWatcher(50.Milliseconds());

            var observer = new TestObserver <(string, Exception)>();

            using (watcher.Subscribe(observer))
            {
                fsWatcher.DidNotReceive().Dispose();
            }
            fsWatcher.Received().Dispose();
        }