Skip to content

Commit f24b197

Browse files
committed
Small code improvements in tests
1 parent 34005d6 commit f24b197

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

NETProvider/src/FirebirdSql.Data.UnitTests/FbConnectionTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
using System.Data;
2424
using System.IO;
2525
using System.Reflection;
26+
using System.Threading;
2627
using FirebirdSql.Data.FirebirdClient;
2728
using NUnit.Framework;
2829

@@ -200,7 +201,7 @@ public void ConnectionPoolingTimeOutTest()
200201
myConnection2.Close();
201202
}
202203

203-
System.Threading.Thread.Sleep(csb.ConnectionLifeTime * 2 * 1000);
204+
Thread.Sleep(TimeSpan.FromSeconds(csb.ConnectionLifeTime + 1));
204205

205206
Assert.AreEqual(active, GetActiveConnections());
206207

@@ -275,7 +276,7 @@ public void ConnectionPoolingMinPoolSizeTest()
275276
connections.ForEach(x => x.Dispose());
276277
}
277278

278-
System.Threading.Thread.Sleep(csb.ConnectionLifeTime * 2 * 1000);
279+
Thread.Sleep(TimeSpan.FromSeconds(csb.ConnectionLifeTime + 1));
279280

280281
Assert.AreEqual(active + csb.MinPoolSize, GetActiveConnections());
281282
}

NETProvider/src/FirebirdSql.Data.UnitTests/TrackerIssuesTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,11 @@ public void DNET595()
272272
{
273273
FbConnection.ClearAllPools();
274274
const int NumberOfThreads = 15;
275-
const int ConnectionLifeTime = 5;
276275

277276
FbConnectionStringBuilder csb = BuildConnectionStringBuilder(this.FbServerType);
278277
csb.Pooling = true;
279-
csb.ConnectionLifeTime = ConnectionLifeTime;
278+
csb.ConnectionLifeTime = 5;
279+
csb.MinPoolSize = 0;
280280
string cs = csb.ToString();
281281

282282
var active = GetActiveConnections();
@@ -309,7 +309,7 @@ public void DNET595()
309309
GetSomething(cs);
310310
}
311311

312-
Thread.Sleep(TimeSpan.FromSeconds(ConnectionLifeTime + 1));
312+
Thread.Sleep(TimeSpan.FromSeconds(csb.ConnectionLifeTime + 1));
313313
Assert.AreEqual(GetActiveConnections(), active);
314314
}
315315

0 commit comments

Comments
 (0)