Beispiel #1
0
        public void TryDispose_ValidParam_ReturnsTrueAndCallsDispose()
        {
            var mockDisposable = new Mock <IDisposable>();

            Assert.IsTrue(DisposableExtensions.TryDispose(mockDisposable.Object));
            mockDisposable.Verify(x => x.Dispose());
        }
        public void TryDispose_ValidParam_ReturnsTrueAndCallsDispose()
        {
            var fake = new FakeDisposable();

            Assert.IsTrue(DisposableExtensions.TryDispose(fake));
            Assert.IsTrue(fake.WasCalled);
        }
Beispiel #3
0
 public void TryDispose_NullParam_ReturnsFalse()
 {
     Assert.IsFalse(DisposableExtensions.TryDispose(null));
 }