Skip to content

Commit

Permalink
Add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra committed Apr 28, 2020
1 parent ab5c096 commit 81d9908
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,36 @@ public static void TimeOutDuringRead()
TimeOutDuringRead(s_connStr);
}

[CheckConnStrSetupFact]
public static void TCPAttentionPacketTest()
{
CancelFollowedByTransaction(tcp_connStr);
}

[CheckConnStrSetupFact]
public static void NPAttentionPacketTest()
{
CancelFollowedByTransaction(np_connStr);
}

private static void CancelFollowedByTransaction(string constr)
{
using (SqlConnection connection = new SqlConnection(constr))
{
connection.Open();
using (SqlCommand cmd = connection.CreateCommand())
{
cmd.CommandText = @"SELECT @@VERSION";
using (var r = cmd.ExecuteReader())
{
cmd.Cancel();
}
}
using (var transaction = connection.BeginTransaction())
{ }
}
}

private static void MultiThreadedCancel(string constr, bool async)
{
using (SqlConnection con = new SqlConnection(constr))
Expand Down

0 comments on commit 81d9908

Please sign in to comment.