コード例 #1
0
        public void DisposeDisposesValue()
        {
            // Fixture setup
            var dummyLease = new Mock <ILease>().Object;
            var sut        = new CacheLifetimeManager(dummyLease);

            var valueMock = new Mock <IDisposable>();

            sut.SetValue(valueMock.Object);
            // Exercise system
            sut.Dispose();
            // Verify outcome
            valueMock.Verify(d => d.Dispose());
            // Teardown
        }
コード例 #2
0
        public void DisposeRemovesValue()
        {
            // Fixture setup
            var dummyLease = new Mock <ILease>().Object;
            var sut        = new CacheLifetimeManager(dummyLease);

            sut.SetValue(new object());
            // Exercise system
            sut.Dispose();
            // Verify outcome
            var result = sut.GetValue();

            Assert.Null(result);
            // Teardown
        }
コード例 #3
0
        public void DisposeDisposesValue()
        {
            // Fixture setup
            var dummyLease = new Mock<ILease>().Object;
            var sut = new CacheLifetimeManager(dummyLease);

            var valueMock = new Mock<IDisposable>();
            sut.SetValue(valueMock.Object);
            // Exercise system
            sut.Dispose();
            // Verify outcome
            valueMock.Verify(d => d.Dispose());
            // Teardown
        }
コード例 #4
0
 public void DisposeRemovesValue()
 {
     // Fixture setup
     var dummyLease = new Mock<ILease>().Object;
     var sut = new CacheLifetimeManager(dummyLease);
     sut.SetValue(new object());
     // Exercise system
     sut.Dispose();
     // Verify outcome
     var result = sut.GetValue();
     Assert.Null(result);
     // Teardown
 }