public void ScopedInstanceDoesNotThrowOnNonIDisposable() { // Arrange var scopedInstance = new ScopedInstance <object>() { Value = new object(), }; // Act scopedInstance.Dispose(); }
public void ScopedInstanceDoesNotThrowOnNull() { // Arrange var scopedInstance = new ScopedInstance <Disposable>() { Value = null, // just making it explicit that there is not value set yet. }; // Act scopedInstance.Dispose(); // Assert Assert.Null(scopedInstance.Value); }
public void ScopedInstanceDisposesIDisposables() { var disposable = new Disposable(); // Arrange var scopedInstance = new ScopedInstance <Disposable> { Value = disposable, }; // Act scopedInstance.Dispose(); // Assert Assert.True(disposable.IsDisposed); }