public void ActionDisposeActionWithException()
        {
            int cntDisposed  = 0;
            int cntFinalized = 0;

            var tdc = new TracedDisposableControl();

            tdc.SetTraceEnabledForAll(true);

            tdc.CurrentReportFinalized = (rfi) => { cntFinalized++; };
            var sut = new ActionDispose(() => { cntDisposed++; throw new ArgumentException("HUGO"); }, tdc);

            try {
                Assert.Throws <ArgumentException>(() => sut.Dispose());
            } catch {
            }
            sut.Dispose(); // no error again
            Assert.Equal(1, cntDisposed);
        }
        public void ActionDisposeT1NoAction()
        {
            int cntDisposed  = 0;
            int cntFinalized = 0;

            var tdc = new TracedDisposableControl();

            tdc.SetTraceEnabledForAll(true);
            tdc.CurrentReportFinalized = (rfi) => { cntFinalized++; };

            var sut = new ActionDispose <int>(null, 0, tdc);

            sut.Dispose(); // no error
            Assert.Equal(0, cntDisposed);
            Assert.Equal(0, cntFinalized);
        }
        public void ActionDisposeActionIsCalledOnDispose()
        {
            int cntDisposed  = 0;
            int cntFinalized = 0;

            var tdc = new TracedDisposableControl();

            tdc.SetTraceEnabledForAll(true);
            tdc.CurrentReportFinalized = (rfi) => { cntFinalized++; };

            var sut = new ActionDispose(() => { cntDisposed++; }, tdc);

            sut.Dispose();
            Assert.Equal(1, cntDisposed);
            Assert.Equal(0, cntFinalized);
        }