Beispiel #1
0
        public void Decrement_should_not_call_dispose_when_reference_count_is_greater_than_zero()
        {
            var subject = new ReferenceCounted <IDisposable>(_mockDisposable.Object);

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

            subject.ReferenceCount.Should().Be(1);
            _mockDisposable.Verify(d => d.Dispose(), Times.Never);
        }
        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();
        }