Commit 80d33f06 authored by Marc Gravell's avatar Marc Gravell

Try to repro #272 (doesn't fail on Win/.NET or Win/CoreCLR)

parent 0dc392b3
...@@ -94,7 +94,7 @@ public static SqlConnection GetOpenConnection(bool mars = false) ...@@ -94,7 +94,7 @@ public static SqlConnection GetOpenConnection(bool mars = false)
connection.Open(); connection.Open();
return connection; return connection;
} }
public static SqlConnection GetClosedConnection() public static SqlConnection GetClosedConnection()
{ {
var conn = new SqlConnection(ConnectionString); var conn = new SqlConnection(ConnectionString);
...@@ -1029,7 +1029,7 @@ public void TestCustomParameters() ...@@ -1029,7 +1029,7 @@ public void TestCustomParameters()
foo.IsEqualTo(123); foo.IsEqualTo(123);
bar.IsEqualTo("abc"); bar.IsEqualTo("abc");
} }
[Fact] [Fact]
public void TestDynamicParamNullSupport() public void TestDynamicParamNullSupport()
{ {
...@@ -1524,17 +1524,26 @@ public void QueryMultipleInvalidFromClosed() ...@@ -1524,17 +1524,26 @@ public void QueryMultipleInvalidFromClosed()
} }
[Fact] [Fact]
public void TestMultiSelectWithSomeEmptyGrids() public void TestMultiSelectWithSomeEmptyGridsUnbuffered()
{
TestMultiSelectWithSomeEmptyGrids(false);
}
[Fact]
public void TestMultiSelectWithSomeEmptyGridsBuffered()
{
TestMultiSelectWithSomeEmptyGrids(true);
}
private void TestMultiSelectWithSomeEmptyGrids(bool buffered)
{ {
using (var reader = connection.QueryMultiple("select 1; select 2 where 1 = 0; select 3 where 1 = 0; select 4;")) using (var reader = connection.QueryMultiple("select 1; select 2 where 1 = 0; select 3 where 1 = 0; select 4;"))
{ {
var one = reader.Read<int>().ToArray(); var one = reader.Read<int>(buffered: buffered).ToArray();
var two = reader.Read<int>().ToArray(); var two = reader.Read<int>(buffered: buffered).ToArray();
var three = reader.Read<int>().ToArray(); var three = reader.Read<int>(buffered: buffered).ToArray();
var four = reader.Read<int>().ToArray(); var four = reader.Read<int>(buffered: buffered).ToArray();
try try
{ // only returned four grids; expect a fifth read to fail { // only returned four grids; expect a fifth read to fail
reader.Read<int>(); reader.Read<int>(buffered: buffered);
throw new InvalidOperationException("this should not have worked!"); throw new InvalidOperationException("this should not have worked!");
} }
catch (ObjectDisposedException ex) catch (ObjectDisposedException ex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment