@@ -54,26 +54,6 @@ public async Task PreLoginEncryptionExcludedTest()
5454 Assert . Contains ( "The instance of SQL Server you attempted to connect to does not support encryption." , ex . Message , StringComparison . OrdinalIgnoreCase ) ;
5555 }
5656
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-
7757 [ ConditionalTheory ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsNotArmProcess ) ) ]
7858 [ InlineData ( 40613 ) ]
7959 [ InlineData ( 42108 ) ]
@@ -97,70 +77,14 @@ public void TransientFaultTest(uint errorCode)
9777 }
9878 catch ( Exception e )
9979 {
80+ if ( null != connection )
81+ {
82+ Assert . Equal ( ConnectionState . Closed , connection . State ) ;
83+ }
10084 Assert . False ( true , e . Message ) ;
10185 }
10286 }
10387
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-
16488 [ Fact ]
16589 public void SqlConnectionDbProviderFactoryTest ( )
16690 {
0 commit comments