Skip to content

Commit

Permalink
Implement SqliteDataReader.GetEnumerator() on .NET Standard
Browse files Browse the repository at this point in the history
Resolves #265
  • Loading branch information
bricelam committed Jun 7, 2016
1 parent d4e5341 commit b2ed245
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
9 changes: 1 addition & 8 deletions src/Microsoft.Data.Sqlite/SqliteDataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,7 @@ public override object this[int ordinal]
/// </summary>
/// <returns>The enumerator.</returns>
public override IEnumerator GetEnumerator()
{
#if NET451
return new DbEnumerator(this);
#else
// TODO: Remove when the System.Data.Common includes DbEnumerator
throw new NotImplementedException();
#endif
}
=> new DbEnumerator(this, closeReader: false);

/// <summary>
/// Advances to the next row in the result set.
Expand Down
19 changes: 0 additions & 19 deletions test/Microsoft.Data.Sqlite.Tests/SqliteDataReaderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,24 +179,6 @@ public void GetDouble_throws_when_null() =>
GetX_throws_when_null(
r => r.GetDouble(0));

#if NETCOREAPP1_0
[Fact]
public void GetEnumerator_not_implemented()
{
using (var connection = new SqliteConnection("Data Source=:memory:"))
{
connection.Open();

using (var reader = connection.ExecuteReader("SELECT 1;"))
{
var hasData = reader.Read();
Assert.True(hasData);

Assert.Throws<NotImplementedException>(() => reader.GetEnumerator());
}
}
}
#else
[Fact]
public void GetEnumerator_works()
{
Expand All @@ -213,7 +195,6 @@ public void GetEnumerator_works()
}
}
}
#endif

[Theory]
[InlineData("SELECT 1;", true)]
Expand Down

0 comments on commit b2ed245

Please sign in to comment.