/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

  1. namespace Rhino.Etl.Tests.Util
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using Core;
  6. using Xunit;
  7. using Mocks;
  8. using Rhino.Etl.Core.DataReaders;
  9. public class DictionaryEnumeratorDataReaderFixture
  10. {
  11. [Fact]
  12. public void WillDisposeInternalEnumeratorAndEnumerableWhenDisposed()
  13. {
  14. MockRepository mocks = new MockRepository();
  15. IEnumerable<Row> enumerable = mocks.DynamicMultiMock<IEnumerable<Row>>(typeof(IDisposable));
  16. IEnumerator<Row> enumerator = mocks.DynamicMock<IEnumerator<Row>>();
  17. using(mocks.Record())
  18. {
  19. SetupResult.For(enumerable.GetEnumerator()).Return(enumerator);
  20. enumerator.Dispose();
  21. ((IDisposable)enumerable).Dispose();
  22. }
  23. using (mocks.Playback())
  24. {
  25. DictionaryEnumeratorDataReader reader =
  26. new DictionaryEnumeratorDataReader(new Dictionary<string, Type>(), enumerable);
  27. reader.Dispose();
  28. }
  29. }
  30. }
  31. }