2
2
using System . ComponentModel ;
3
3
using System . Globalization ;
4
4
using System . Linq ;
5
- #if BASELINE
5
+ #if MYSQL_DATA
6
6
using MySql . Data . MySqlClient ;
7
7
#endif
8
8
using Xunit ;
@@ -20,7 +20,7 @@ public void Defaults()
20
20
Assert . False ( csb . AllowUserVariables ) ;
21
21
Assert . False ( csb . AllowZeroDateTime ) ;
22
22
Assert . True ( csb . AutoEnlist ) ;
23
- #if BASELINE
23
+ #if MYSQL_DATA
24
24
Assert . Null ( csb . CertificateFile ) ;
25
25
Assert . Null ( csb . CertificatePassword ) ;
26
26
Assert . Null ( csb . CertificateThumbprint ) ;
@@ -34,7 +34,7 @@ public void Defaults()
34
34
Assert . Equal ( "" , csb . CharacterSet ) ;
35
35
Assert . Equal ( 0u , csb . ConnectionLifeTime ) ;
36
36
Assert . Equal ( MySqlConnectionProtocol . Sockets , csb . ConnectionProtocol ) ;
37
- #if BASELINE
37
+ #if MYSQL_DATA
38
38
Assert . False ( csb . ConnectionReset ) ;
39
39
#else
40
40
Assert . True ( csb . ConnectionReset ) ;
@@ -45,12 +45,12 @@ public void Defaults()
45
45
#endif
46
46
Assert . Equal ( 15u , csb . ConnectionTimeout ) ;
47
47
Assert . False ( csb . ConvertZeroDateTime ) ;
48
- #if ! BASELINE
48
+ #if ! MYSQL_DATA
49
49
Assert . Equal ( MySqlDateTimeKind . Unspecified , csb . DateTimeKind ) ;
50
50
#endif
51
51
Assert . Equal ( "" , csb . Database ) ;
52
52
Assert . Equal ( 30u , csb . DefaultCommandTimeout ) ;
53
- #if ! BASELINE
53
+ #if ! MYSQL_DATA
54
54
Assert . Equal ( "" , csb . ApplicationName ) ;
55
55
Assert . Equal ( 180u , csb . ConnectionIdleTimeout ) ;
56
56
Assert . False ( csb . ForceSynchronous ) ;
@@ -65,19 +65,19 @@ public void Defaults()
65
65
Assert . Equal ( 0u , csb . MinimumPoolSize ) ;
66
66
Assert . Equal ( "" , csb . Password ) ;
67
67
Assert . Equal ( "MYSQL" , csb . PipeName ) ;
68
- #if ! BASELINE
68
+ #if ! MYSQL_DATA
69
69
Assert . False ( csb . NoBackslashEscapes ) ;
70
70
Assert . Equal ( MySqlServerRedirectionMode . Disabled , csb . ServerRedirectionMode ) ;
71
71
#endif
72
72
Assert . False ( csb . OldGuids ) ;
73
73
Assert . False ( csb . PersistSecurityInfo ) ;
74
- #if ! BASELINE
74
+ #if ! MYSQL_DATA
75
75
Assert . True ( csb . Pipelining ) ;
76
76
#endif
77
77
Assert . True ( csb . Pooling ) ;
78
78
Assert . Equal ( 3306u , csb . Port ) ;
79
79
Assert . Equal ( "" , csb . Server ) ;
80
- #if ! BASELINE
80
+ #if ! MYSQL_DATA
81
81
Assert . Equal ( "" , csb . ServerRsaPublicKeyFile ) ;
82
82
Assert . Equal ( "" , csb . ServerSPN ) ;
83
83
Assert . Equal ( "" , csb . SslCa ) ;
@@ -96,7 +96,7 @@ public void Defaults()
96
96
Assert . False ( csb . UseCompression ) ;
97
97
Assert . Equal ( "" , csb . UserID ) ;
98
98
Assert . False ( csb . UseAffectedRows ) ;
99
- #if ! BASELINE
99
+ #if ! MYSQL_DATA
100
100
Assert . True ( csb . UseXaTransactions ) ;
101
101
#endif
102
102
}
@@ -123,11 +123,11 @@ public void ParseConnectionString()
123
123
"connection lifetime=15;" +
124
124
"ConnectionReset=false;" +
125
125
"Convert Zero Datetime=true;" +
126
- #if ! BASELINE
126
+ #if ! MYSQL_DATA
127
127
"datetimekind=utc;" +
128
128
#endif
129
129
"default command timeout=123;" +
130
- #if ! BASELINE
130
+ #if ! MYSQL_DATA
131
131
"application name=My Test Application;" +
132
132
"cancellation timeout = -1;" +
133
133
"connectionidletimeout=30;" +
@@ -171,7 +171,7 @@ public void ParseConnectionString()
171
171
Assert. True ( csb . AllowUserVariables ) ;
172
172
Assert. True ( csb . AllowZeroDateTime ) ;
173
173
Assert. False ( csb . AutoEnlist ) ;
174
- #if ! BASELINE
174
+ #if ! MYSQL_DATA
175
175
Assert . Equal ( - 1 , csb . CancellationTimeout ) ;
176
176
// Connector/NET treats "CertificateFile" (client certificate) and "SslCa" (server CA) as aliases
177
177
Assert . Equal ( "file.pfx" , csb . CertificateFile ) ;
@@ -185,12 +185,12 @@ public void ParseConnectionString()
185
185
Assert . False ( csb . ConnectionReset ) ;
186
186
Assert . Equal ( 30u , csb . ConnectionTimeout ) ;
187
187
Assert . True ( csb . ConvertZeroDateTime ) ;
188
- #if ! BASELINE
188
+ #if ! MYSQL_DATA
189
189
Assert . Equal ( MySqlDateTimeKind . Utc , csb . DateTimeKind ) ;
190
190
#endif
191
191
Assert . Equal ( "schema_name" , csb . Database ) ;
192
192
Assert . Equal ( 123u , csb . DefaultCommandTimeout ) ;
193
- #if ! BASELINE
193
+ #if ! MYSQL_DATA
194
194
Assert . Equal ( "My Test Application" , csb . ApplicationName ) ;
195
195
Assert. Equal ( 30u , csb . ConnectionIdleTimeout ) ;
196
196
#pragma warning disable 618
@@ -226,7 +226,7 @@ public void ParseConnectionString()
226
226
Assert. Equal ( "client-cert.pem" , csb . SslCert ) ;
227
227
Assert. Equal ( "client-key.pem" , csb . SslKey ) ;
228
228
Assert. Equal ( MySqlSslMode . VerifyCA , csb . SslMode ) ;
229
- #if BASELINE
229
+ #if MYSQL_DATA
230
230
Assert. Equal ( "Tls12, Tls13" , csb . TlsVersion ) ;
231
231
#else
232
232
Assert . Equal ( "TLS 1.2, TLS 1.3" , csb . TlsVersion ) ;
@@ -235,7 +235,7 @@ public void ParseConnectionString()
235
235
Assert. True ( csb . UseCompression ) ;
236
236
Assert. Equal ( "username" , csb . UserID ) ;
237
237
238
- #if ! BASELINE
238
+ #if ! MYSQL_DATA
239
239
Assert. Equal ( "Server=db-server;Port=1234;User ID=username;Password=Pass1234;Database=schema_name;Load Balance=Random;" +
240
240
"Connection Protocol=Pipe;Pipe Name=MyPipe;SSL Mode=VerifyCA;Certificate File=file.pfx;Certificate Password=Pass2345;" +
241
241
"Certificate Store Location=CurrentUser;Certificate Thumbprint=thumbprint123;SSL Cert=client-cert.pem;SSL Key=client-key.pem;" +
@@ -259,7 +259,7 @@ public void EnumInvalidOperation()
259
259
Assert . Throws < ArgumentException > ( ( ) => new MySqlConnectionStringBuilder ( "ssl mode=invalid;" ) ) ;
260
260
}
261
261
262
- #if ! BASELINE
262
+ #if ! MYSQL_DATA
263
263
[ Fact ]
264
264
public void ConstructWithNull ( )
265
265
{
@@ -391,7 +391,7 @@ public void SetCharacterSetToNull()
391
391
Assert . Equal ( "" , csb . ConnectionString ) ;
392
392
}
393
393
394
- #if ! BASELINE
394
+ #if ! MYSQL_DATA
395
395
[ Fact ]
396
396
public void SetApplicationNameToNull ( )
397
397
{
@@ -418,7 +418,7 @@ public void SetServerSPNToNull()
418
418
#endif
419
419
420
420
[ Theory ]
421
- #if ! BASELINE
421
+ #if ! MYSQL_DATA
422
422
[ InlineData ( "Tls" , "0" ) ]
423
423
[ InlineData ( "Tls1" , "0" ) ]
424
424
[ InlineData ( "Tlsv1" , "0" ) ]
@@ -441,7 +441,7 @@ public void SetServerSPNToNull()
441
441
[ InlineData ( "Tlsv1.3" , "3" ) ]
442
442
[ InlineData ( "TLS 1.3" , "3" ) ]
443
443
[ InlineData ( "TLS v1.3" , "3" ) ]
444
- #if ! BASELINE
444
+ #if ! MYSQL_DATA
445
445
[ InlineData ( "Tls,Tls" , "0" ) ]
446
446
[ InlineData ( "Tls1.1,Tls v1.1, TLS 1.1" , "1" ) ]
447
447
[ InlineData ( "Tls12,Tls10" , "0,2" ) ]
@@ -451,7 +451,7 @@ public void SetServerSPNToNull()
451
451
public void ParseTlsVersion ( string input , string expected )
452
452
{
453
453
var csb = new MySqlConnectionStringBuilder { TlsVersion = input } ;
454
- #if ! BASELINE
454
+ #if ! MYSQL_DATA
455
455
string [ ] normalizedVersions = new [ ] { "TLS 1.0" , "TLS 1.1" , "TLS 1.2" , "TLS 1.3" } ;
456
456
#else
457
457
string [ ] normalizedVersions = new [ ] { "Tls" , "Tls11" , "Tls12" , "Tls13" } ;
@@ -469,7 +469,7 @@ public void ParseInvalidTlsVersion()
469
469
}
470
470
471
471
[ Theory ]
472
- #if BASELINE
472
+ #if MYSQL_DATA
473
473
[ InlineData ( "AllowPublicKeyRetrieval" , false ) ]
474
474
#else
475
475
[ InlineData ( "Allow Public Key Retrieval" , false ) ]
@@ -484,7 +484,7 @@ public void ParseInvalidTlsVersion()
484
484
[ InlineData ( "Connection Lifetime" , 30u ) ]
485
485
[ InlineData ( "Connection Protocol" , MySqlConnectionProtocol . NamedPipe ) ]
486
486
[ InlineData ( "Connection Reset" , true ) ]
487
- #if BASELINE
487
+ #if MYSQL_DATA
488
488
[ InlineData ( "Connect Timeout" , 10u ) ]
489
489
#else
490
490
[ InlineData ( "Connection Timeout" , 10u ) ]
@@ -504,7 +504,7 @@ public void ParseInvalidTlsVersion()
504
504
[ InlineData ( "Port" , 3307u ) ]
505
505
[ InlineData ( "Server" , "localhost" ) ]
506
506
[ InlineData ( "SSL Mode" , MySqlSslMode . Required ) ]
507
- #if BASELINE
507
+ #if MYSQL_DATA
508
508
[ InlineData ( "TLS version" , "Tls12" ) ]
509
509
#else
510
510
[ InlineData ( "TLS Version" , "TLS 1.2" ) ]
@@ -513,7 +513,7 @@ public void ParseInvalidTlsVersion()
513
513
[ InlineData ( "Use Affected Rows" , false ) ]
514
514
[ InlineData ( "Use Compression" , true ) ]
515
515
[ InlineData ( "User ID" , "user" ) ]
516
- #if ! BASELINE
516
+ #if ! MYSQL_DATA
517
517
// misspelled
518
518
[ InlineData ( "Allow Load Local Infile" , true ) ]
519
519
@@ -544,14 +544,14 @@ public void ParseInvalidTlsVersion()
544
544
public void NamedProperty ( string propertyName , object value )
545
545
{
546
546
var stringValue = Convert . ToString ( value , CultureInfo . InvariantCulture ) ;
547
- #if BASELINE
547
+ #if MYSQL_DATA
548
548
// fix some properties that are spelt differently
549
549
propertyName = propertyName . Replace ( "SSL " , "Ssl " ) . Replace ( "DateTime" , "Datetime" ) ;
550
550
#endif
551
551
for ( var i = 0 ; i < 2 ; i ++ )
552
552
{
553
553
var csb = new MySqlConnectionStringBuilder ( ) ;
554
- #if ! BASELINE
554
+ #if ! MYSQL_DATA
555
555
Assert . False ( csb . ContainsKey ( propertyName ) ) ;
556
556
Assert . False ( csb . TryGetValue ( propertyName , out var setValue ) ) ;
557
557
Assert . Null ( setValue ) ;
@@ -573,14 +573,14 @@ public void NamedProperty(string propertyName, object value)
573
573
Assert . True ( csb . ContainsKey ( propertyName ) ) ;
574
574
575
575
Assert . True ( csb . TryGetValue ( propertyName , out setValue ) ) ;
576
- #if ! BASELINE
576
+ #if ! MYSQL_DATA
577
577
Assert . Equal ( stringValue , setValue ) ;
578
578
#else
579
579
Assert . Equal ( value , setValue ) ;
580
580
#endif
581
581
582
582
var propertyDescriptorValue = propertyDescriptor . GetValue ( csb ) ;
583
- #if ! BASELINE
583
+ #if ! MYSQL_DATA
584
584
Assert . Equal ( stringValue , propertyDescriptorValue ) ;
585
585
#else
586
586
Assert . Equal ( value , propertyDescriptorValue ) ;
0 commit comments