public void Dispose_Should_Release_Allocated_Resources()
        {
            var target = new StackHistory();

            using (var helper = new HistoryHelper(target))
            {
                target.Snapshot(() => { }, () => { });
                target.Snapshot(() => { }, () => { });
                var result = target.Undo();
                Assert.Single(target.Undos);
                Assert.Single(target.Redos);
                Assert.True(result);

                target.Dispose();

                Assert.Empty(target.Undos);
                Assert.Empty(target.Redos);

                Assert.Throws <ObjectDisposedException>(() => target.CanUndo.Subscribe(_ => { }));
                Assert.Throws <ObjectDisposedException>(() => target.CanRedo.Subscribe(_ => { }));
                Assert.Throws <ObjectDisposedException>(() => target.CanClear.Subscribe(_ => { }));
            }
        }
        public void Dispose_Should_Release_Allocated_Resources()
        {
            var target = new StackHistory();

            using (var helper = new HistoryHelper(target))
            {
                target.Snapshot(() => { }, () => { });
                target.Snapshot(() => { }, () => { });
                var result = target.Undo();
                Assert.Equal(1, target.Undos.Count);
                Assert.Equal(1, target.Redos.Count);
                Assert.Equal(true, result);

                target.Dispose();

                Assert.Null(target.Undos);
                Assert.Null(target.Redos);

                Assert.Throws(typeof(ObjectDisposedException), () => target.CanUndo.Subscribe(_ => { }));
                Assert.Throws(typeof(ObjectDisposedException), () => target.CanRedo.Subscribe(_ => { }));
                Assert.Throws(typeof(ObjectDisposedException), () => target.CanClear.Subscribe(_ => { }));
            }
        }