@@ -54,26 +54,6 @@ public async Task PreLoginEncryptionExcludedTest()
54
54
Assert . Contains ( "The instance of SQL Server you attempted to connect to does not support encryption." , ex . Message , StringComparison . OrdinalIgnoreCase ) ;
55
55
}
56
56
57
- [ ConditionalTheory ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsNotArmProcess ) ) ]
58
- [ InlineData ( 40613 ) ]
59
- [ InlineData ( 42108 ) ]
60
- [ InlineData ( 42109 ) ]
61
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
62
- public async Task TransientFaultTestAsync ( uint errorCode )
63
- {
64
- using TransientFaultTDSServer server = TransientFaultTDSServer . StartTestServer ( true , true , errorCode ) ;
65
- SqlConnectionStringBuilder builder = new ( )
66
- {
67
- DataSource = "localhost," + server . Port ,
68
- IntegratedSecurity = true ,
69
- Encrypt = SqlConnectionEncryptOption . Optional
70
- } ;
71
-
72
- using SqlConnection connection = new ( builder . ConnectionString ) ;
73
- await connection . OpenAsync ( ) ;
74
- Assert . Equal ( ConnectionState . Open , connection . State ) ;
75
- }
76
-
77
57
[ ConditionalTheory ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsNotArmProcess ) ) ]
78
58
[ InlineData ( 40613 ) ]
79
59
[ InlineData ( 42108 ) ]
@@ -97,70 +77,14 @@ public void TransientFaultTest(uint errorCode)
97
77
}
98
78
catch ( Exception e )
99
79
{
80
+ if ( null != connection )
81
+ {
82
+ Assert . Equal ( ConnectionState . Closed , connection . State ) ;
83
+ }
100
84
Assert . False ( true , e . Message ) ;
101
85
}
102
86
}
103
87
104
- [ ConditionalTheory ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsNotArmProcess ) ) ]
105
- [ InlineData ( 40613 ) ]
106
- [ InlineData ( 42108 ) ]
107
- [ InlineData ( 42109 ) ]
108
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
109
- public async Task TransientFaultDisabledTestAsync ( uint errorCode )
110
- {
111
- using TransientFaultTDSServer server = TransientFaultTDSServer . StartTestServer ( true , true , errorCode ) ;
112
- SqlConnectionStringBuilder builder = new ( )
113
- {
114
- DataSource = "localhost," + server . Port ,
115
- IntegratedSecurity = true ,
116
- ConnectRetryCount = 0 ,
117
- Encrypt = SqlConnectionEncryptOption . Optional
118
- } ;
119
-
120
- using SqlConnection connection = new ( builder . ConnectionString ) ;
121
- try
122
- {
123
- await connection . OpenAsync ( ) ;
124
- Assert . False ( true , "Connection should not have opened." ) ;
125
- }
126
- catch ( SqlException e )
127
- {
128
- // FATAL Error, should result in closed connection.
129
- Assert . Equal ( 20 , e . Class ) ;
130
- Assert . Equal ( ConnectionState . Closed , connection . State ) ;
131
- }
132
- }
133
-
134
- [ ConditionalTheory ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsNotArmProcess ) ) ]
135
- [ InlineData ( 40613 ) ]
136
- [ InlineData ( 42108 ) ]
137
- [ InlineData ( 42109 ) ]
138
- [ PlatformSpecific ( TestPlatforms . Windows ) ]
139
- public void TransientFaultDisabledTest ( uint errorCode )
140
- {
141
- using TransientFaultTDSServer server = TransientFaultTDSServer . StartTestServer ( true , true , errorCode ) ;
142
- SqlConnectionStringBuilder builder = new ( )
143
- {
144
- DataSource = "localhost," + server . Port ,
145
- IntegratedSecurity = true ,
146
- ConnectRetryCount = 0 ,
147
- Encrypt = SqlConnectionEncryptOption . Optional
148
- } ;
149
-
150
- using SqlConnection connection = new ( builder . ConnectionString ) ;
151
- try
152
- {
153
- connection . Open ( ) ;
154
- Assert . False ( true , "Connection should not have opened." ) ;
155
- }
156
- catch ( SqlException e )
157
- {
158
- // FATAL Error, should result in closed connection.
159
- Assert . Equal ( 20 , e . Class ) ;
160
- Assert . Equal ( ConnectionState . Closed , connection . State ) ;
161
- }
162
- }
163
-
164
88
[ Fact ]
165
89
public void SqlConnectionDbProviderFactoryTest ( )
166
90
{
0 commit comments