Skip to content

Commit 8392099

Browse files
committed
Small refactoring.
1 parent ba5a8d1 commit 8392099

File tree

5 files changed

+68
-60
lines changed

5 files changed

+68
-60
lines changed

Provider/src/FirebirdSql.Data.FirebirdClient.Tests/FbConnectionTests.cs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void BeginTransactionILSerializableTest()
7272
[Test]
7373
public void BeginTransactionNoWaitTimeoutTest()
7474
{
75-
using (var conn = new FbConnection(BuildConnectionString(FbServerType, Compression, WireCrypt)))
75+
using (var conn = new FbConnection(BuildConnectionString(ServerType, Compression, WireCrypt)))
7676
{
7777
conn.Open();
7878
var tx = conn.BeginTransaction(new FbTransactionOptions() { WaitTimeout = null });
@@ -84,7 +84,7 @@ public void BeginTransactionNoWaitTimeoutTest()
8484
[Test]
8585
public void BeginTransactionWithWaitTimeoutTest()
8686
{
87-
using (var conn = new FbConnection(BuildConnectionString(FbServerType, Compression, WireCrypt)))
87+
using (var conn = new FbConnection(BuildConnectionString(ServerType, Compression, WireCrypt)))
8888
{
8989
conn.Open();
9090
var tx = conn.BeginTransaction(new FbTransactionOptions() { WaitTimeout = TimeSpan.FromSeconds(10) });
@@ -96,7 +96,7 @@ public void BeginTransactionWithWaitTimeoutTest()
9696
[Test]
9797
public void BeginTransactionWithWaitTimeoutInvalidValue1Test()
9898
{
99-
using (var conn = new FbConnection(BuildConnectionString(FbServerType, Compression, WireCrypt)))
99+
using (var conn = new FbConnection(BuildConnectionString(ServerType, Compression, WireCrypt)))
100100
{
101101
conn.Open();
102102
Assert.Throws<ArgumentException>(() => conn.BeginTransaction(new FbTransactionOptions() { WaitTimeout = TimeSpan.FromDays(9999) }));
@@ -106,7 +106,7 @@ public void BeginTransactionWithWaitTimeoutInvalidValue1Test()
106106
[Test]
107107
public void BeginTransactionWithWaitTimeoutInvalidValue2Test()
108108
{
109-
using (var conn = new FbConnection(BuildConnectionString(FbServerType, Compression, WireCrypt)))
109+
using (var conn = new FbConnection(BuildConnectionString(ServerType, Compression, WireCrypt)))
110110
{
111111
conn.Open();
112112
Assert.Throws<ArgumentException>(() => conn.BeginTransaction(new FbTransactionOptions() { WaitTimeout = TimeSpan.FromMilliseconds(1) }));
@@ -125,7 +125,7 @@ public void CreateCommandTest()
125125
public void ConnectionPoolingOnTest()
126126
{
127127
FbConnection.ClearAllPools();
128-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
128+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
129129
csb.Pooling = true;
130130
csb.ConnectionLifeTime = 5;
131131
var cs = csb.ToString();
@@ -149,7 +149,7 @@ public void ConnectionPoolingOnTest()
149149
public void ConnectionPoolingOffTest()
150150
{
151151
FbConnection.ClearAllPools();
152-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
152+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
153153
csb.Pooling = false;
154154
csb.ConnectionLifeTime = 5;
155155
var cs = csb.ToString();
@@ -173,7 +173,7 @@ public void ConnectionPoolingOffTest()
173173
public void ConnectionPoolingLifetimeTest()
174174
{
175175
FbConnection.ClearAllPools();
176-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
176+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
177177
csb.Pooling = true;
178178
csb.ConnectionLifeTime = 5;
179179
var cs = csb.ToString();
@@ -198,7 +198,7 @@ public void ConnectionPoolingLifetimeTest()
198198
public void ConnectionPoolingMaxPoolSizeTest()
199199
{
200200
FbConnection.ClearAllPools();
201-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
201+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
202202
csb.Pooling = true;
203203
csb.ConnectionLifeTime = 120;
204204
csb.MaxPoolSize = 10;
@@ -230,7 +230,7 @@ public void ConnectionPoolingMaxPoolSizeTest()
230230
[Test]
231231
public void ConnectionPoolingMinPoolSizeTest()
232232
{
233-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
233+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
234234
csb.Pooling = true;
235235
csb.ConnectionLifeTime = 5;
236236
csb.MinPoolSize = 3;
@@ -262,7 +262,7 @@ public void ConnectionPoolingFailedNewConnectionIsNotBlockingPool()
262262
{
263263
const int Size = 2;
264264

265-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
265+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
266266
csb.Pooling = true;
267267
csb.ConnectionLifeTime = 100;
268268
csb.MaxPoolSize = Size;
@@ -298,7 +298,7 @@ public void ConnectionPoolingFailedNewConnectionIsNotBlockingPool()
298298
[Test]
299299
public void NoDatabaseTriggersWrongConnectionStringTest()
300300
{
301-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
301+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
302302
csb.Pooling = true;
303303
csb.NoDatabaseTriggers = true;
304304
Assert.Throws<ArgumentException>(() => new FbConnection(csb.ToString()));
@@ -307,7 +307,7 @@ public void NoDatabaseTriggersWrongConnectionStringTest()
307307
[Test]
308308
public void DatabaseTriggersTest()
309309
{
310-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
310+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
311311
csb.Pooling = false;
312312

313313
int rows;
@@ -337,7 +337,7 @@ public void DatabaseTriggersTest()
337337
[Test]
338338
public void UserIDCorrectlyPassedToServer()
339339
{
340-
using (var conn = new FbConnection(BuildConnectionString(FbServerType, Compression, WireCrypt)))
340+
using (var conn = new FbConnection(BuildConnectionString(ServerType, Compression, WireCrypt)))
341341
{
342342
conn.Open();
343343
using (var command = conn.CreateCommand())
@@ -353,12 +353,12 @@ public void UserIDCorrectlyPassedToServer()
353353
[Test]
354354
public void UseTrustedAuth()
355355
{
356-
if (WireCrypt == FbWireCrypt.Required)
356+
if (!EnsureWireCrypt(FbWireCrypt.Disabled))
357357
return;
358358
if (!EnsureServerType(FbServerType.Default))
359359
return;
360360

361-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
361+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
362362
csb.UserID = string.Empty;
363363
csb.Password = string.Empty;
364364
using (var conn = new FbConnection(csb.ToString()))
@@ -370,7 +370,7 @@ public void UseTrustedAuth()
370370
[Test]
371371
public void CreateDropDatabaseUsingTrustedAuth()
372372
{
373-
if (WireCrypt == FbWireCrypt.Required)
373+
if (!EnsureWireCrypt(FbWireCrypt.Disabled))
374374
return;
375375
if (!EnsureServerType(FbServerType.Default))
376376
return;
@@ -385,7 +385,7 @@ public void CreateDropDatabaseUsingTrustedAuth()
385385
}
386386
try
387387
{
388-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
388+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
389389
csb.UserID = string.Empty;
390390
csb.Password = string.Empty;
391391
csb.Database = $"{Guid.NewGuid().ToString()}.fdb";
@@ -415,7 +415,7 @@ public void UseCompression(bool compression)
415415
if (!EnsureServerType(FbServerType.Default))
416416
return;
417417

418-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
418+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
419419
csb.Compression = compression;
420420
using (var conn = new FbConnection(csb.ToString()))
421421
{
@@ -442,7 +442,7 @@ public void UseWireCrypt(FbWireCrypt wireCrypt)
442442
if (!EnsureServerType(FbServerType.Default))
443443
return;
444444

445-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
445+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
446446
csb.WireCrypt = wireCrypt;
447447
using (var conn = new FbConnection(csb.ToString()))
448448
{
@@ -462,7 +462,7 @@ public void UseWireCrypt(FbWireCrypt wireCrypt)
462462
[Test, Explicit]
463463
public void PassCryptKey()
464464
{
465-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
465+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
466466
csb.Database = "enc.fdb";
467467
void Test()
468468
{
@@ -479,7 +479,7 @@ void Test()
479479
[Test, Explicit]
480480
public void DoNotGoBackToPoolAfterBroken()
481481
{
482-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
482+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
483483
csb.Pooling = true;
484484
using (var conn = new FbConnection(csb.ToString()))
485485
{
@@ -511,7 +511,7 @@ public void CaseSensitiveLogin()
511511
if (!EnsureVersion(new Version(3, 0, 0, 0)))
512512
return;
513513

514-
var connectionString = BuildConnectionString(FbServerType, Compression, WireCrypt);
514+
var connectionString = BuildConnectionString(ServerType, Compression, WireCrypt);
515515
using (var conn = new FbConnection(connectionString))
516516
{
517517
conn.Open();
@@ -551,7 +551,7 @@ public void InvalidCredentialsGiveProperError()
551551
if (!EnsureServerType(FbServerType.Default))
552552
return;
553553

554-
var csb = BuildConnectionStringBuilder(FbServerType, Compression, WireCrypt);
554+
var csb = BuildConnectionStringBuilder(ServerType, Compression, WireCrypt);
555555
csb.Password = string.Empty;
556556
using (var conn = new FbConnection(csb.ToString()))
557557
{
@@ -586,7 +586,7 @@ public FbTransaction BeginTransaction(IsolationLevel level)
586586

587587
private void BeginTransactionILTestsHelper(IsolationLevel level)
588588
{
589-
using (var conn = new FbConnection(BuildConnectionString(FbServerType, Compression, WireCrypt)))
589+
using (var conn = new FbConnection(BuildConnectionString(ServerType, Compression, WireCrypt)))
590590
{
591591
conn.Open();
592592
var tx = conn.BeginTransaction(level);

0 commit comments

Comments
 (0)