Skip to content

Commit 2bf7797

Browse files
committedNov 24, 2017
Fix incorrect test results.
If ExecuteReader doesn't throw, it may need to be disposed to prevent a different failure later.
1 parent 0f10ef1 commit 2bf7797

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎src/AdoNet.Specification.Tests/CommandTestBase.cs

+12-2
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,12 @@ public virtual void ExecuteReader_throws_when_transaction_required()
158158

159159
using (connection.BeginTransaction())
160160
{
161-
Assert.Throws<InvalidOperationException>(() => command.ExecuteReader());
161+
Assert.Throws<InvalidOperationException>(() =>
162+
{
163+
using (command.ExecuteReader())
164+
{
165+
}
166+
});
162167
}
163168
}
164169
}
@@ -176,7 +181,12 @@ public virtual void ExecuteReader_throws_when_transaction_mismatched()
176181
{
177182
command.Transaction = otherTransaction;
178183

179-
Assert.Throws<InvalidOperationException>(() => command.ExecuteReader());
184+
Assert.Throws<InvalidOperationException>(() =>
185+
{
186+
using (command.ExecuteReader())
187+
{
188+
}
189+
});
180190
}
181191
}
182192
}

0 commit comments

Comments
 (0)
Please sign in to comment.