/Rhino.Etl.Tests/Util/DictionaryEnumeratorDataReaderFixture.cs
http://github.com/ayende/rhino-etl · C# · 33 lines · 31 code · 2 blank · 0 comment · 0 complexity · c91cdc6c7d000b70c4b89756c89b06b5 MD5 · raw file
- namespace Rhino.Etl.Tests.Util
- {
- using System;
- using System.Collections.Generic;
- using Core;
- using Xunit;
- using Mocks;
- using Rhino.Etl.Core.DataReaders;
-
- public class DictionaryEnumeratorDataReaderFixture
- {
- [Fact]
- public void WillDisposeInternalEnumeratorAndEnumerableWhenDisposed()
- {
- MockRepository mocks = new MockRepository();
- IEnumerable<Row> enumerable = mocks.DynamicMultiMock<IEnumerable<Row>>(typeof(IDisposable));
- IEnumerator<Row> enumerator = mocks.DynamicMock<IEnumerator<Row>>();
- using(mocks.Record())
- {
- SetupResult.For(enumerable.GetEnumerator()).Return(enumerator);
- enumerator.Dispose();
- ((IDisposable)enumerable).Dispose();
- }
- using (mocks.Playback())
- {
- DictionaryEnumeratorDataReader reader =
- new DictionaryEnumeratorDataReader(new Dictionary<string, Type>(), enumerable);
- reader.Dispose();
- }
- }
- }
- }