Dispose() public method

Releases unmanaged and - optionally - managed resources
public Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
return void
示例#1
0
        public void IsDisposedAfterDisposeIsTrue()
        {
            var testee = new DisposeNotifyingObject();

            testee.Dispose();

            testee.IsDisposed.Should().BeTrue();
        }
        public void IsDisposedAfterDisposeIsTrue()
        {
            var testee = new DisposeNotifyingObject();

            testee.Dispose();

            testee.IsDisposed.Should().BeTrue();
        }
        public void NotifiesWhenDisposed()
        {
            var disposed = false;
            var testee = new DisposeNotifyingObject();
            testee.Disposed += (sender, e) => disposed = true;

            testee.Dispose();

            disposed.Should().BeTrue();
        }
示例#4
0
        public void NotifiesWhenDisposed()
        {
            var disposed = false;
            var testee   = new DisposeNotifyingObject();

            testee.Disposed += (sender, e) => disposed = true;

            testee.Dispose();

            disposed.Should().BeTrue();
        }