示例#1
0
        public void TestDispose()
        {
            var result = new DatabaseResult <TestEntity>(DummyEnumerator(), 5);

            result.Dispose();
            try
            {
                var a = result.Current;
                Assert.Fail("This should've failed!");
            }
            catch (ObjectDisposedException) { }

            try
            {
                result.MoveNext();
                Assert.Fail("This should've failed!");
            }
            catch (ObjectDisposedException) { }

            try
            {
                var enumerator = result.GetEnumerator();
                enumerator.MoveNext();
                Assert.Fail("This should've failed!");
            }
            catch (ObjectDisposedException) { }
        }