コード例 #1
0
        public void WillNotThrowException()
        {
            int count = 0;
            var disposable1 = new DisposableAction(() => { throw new Exception(); });
            var newDisp = disposable1.ComposeWith(disposable1);
            newDisp.Dispose();

            count.Should().Be(0);
        }
コード例 #2
0
        public void CanDisposeOneItem()
        {
            int count = 0;
            var disposable1 = new DisposableAction(() => count++);
            var newDisp = disposable1.ComposeWith();
            newDisp.Dispose();

            count.Should().Be(1);
        }
コード例 #3
0
        public void CanDisposeOneItem()
        {
            int count       = 0;
            var disposable1 = new DisposableAction(() => count++);
            var newDisp     = disposable1.ComposeWith();

            newDisp.Dispose();

            count.Should().Be(1);
        }
コード例 #4
0
        public void WillNotThrowException()
        {
            int count       = 0;
            var disposable1 = new DisposableAction(() => { throw new Exception(); });
            var newDisp     = disposable1.ComposeWith(disposable1);

            newDisp.Dispose();

            count.Should().Be(0);
        }
コード例 #5
0
        public void CanDisposeTwoItemsLIFO2()
        {
            int count = 7;
            var disposable1 = new DisposableAction(() => count %= 7);
            var disposable2 = new DisposableAction(() => count += 8);
            var newDisp = disposable2.ComposeWith(disposable1);
            newDisp.Dispose();

            count.Should().Be(8);
        }
コード例 #6
0
        public void CanDisposeTwoItemsLIFO2()
        {
            int count       = 7;
            var disposable1 = new DisposableAction(() => count %= 7);
            var disposable2 = new DisposableAction(() => count += 8);
            var newDisp     = disposable2.ComposeWith(disposable1);

            newDisp.Dispose();

            count.Should().Be(8);
        }