@@ -57,26 +57,6 @@ public async Task PreLoginEncryptionExcludedTest()
5757 Assert . Contains ( "The instance of SQL Server you attempted to connect to does not support encryption." , ex . Message , StringComparison . OrdinalIgnoreCase ) ;
5858 }
5959
60- [ ConditionalTheory ( typeof ( TestUtility ) , nameof ( TestUtility . IsNotArmProcess ) ) ]
61- [ InlineData ( 40613 ) ]
62- [ InlineData ( 42108 ) ]
63- [ InlineData ( 42109 ) ]
64- [ PlatformSpecific ( TestPlatforms . Windows ) ]
65- public async Task TransientFaultTestAsync ( uint errorCode )
66- {
67- using TransientFaultTDSServer server = TransientFaultTDSServer . StartTestServer ( true , true , errorCode ) ;
68- SqlConnectionStringBuilder builder = new ( )
69- {
70- DataSource = "localhost," + server . Port ,
71- IntegratedSecurity = true ,
72- Encrypt = SqlConnectionEncryptOption . Optional
73- } ;
74-
75- using SqlConnection connection = new ( builder . ConnectionString ) ;
76- await connection . OpenAsync ( ) ;
77- Assert . Equal ( ConnectionState . Open , connection . State ) ;
78- }
79-
8060 [ ConditionalTheory ( typeof ( TestUtility ) , nameof ( TestUtility . IsNotArmProcess ) ) ]
8161 [ InlineData ( 40613 ) ]
8262 [ InlineData ( 42108 ) ]
@@ -100,54 +80,14 @@ public void TransientFaultTest(uint errorCode)
10080 }
10181 catch ( Exception e )
10282 {
83+ if ( null != connection )
84+ {
85+ Assert . Equal ( ConnectionState . Closed , connection . State ) ;
86+ }
10387 Assert . Fail ( e . Message ) ;
10488 }
10589 }
10690
107- [ ConditionalTheory ( typeof ( TestUtility ) , nameof ( TestUtility . IsNotArmProcess ) ) ]
108- [ InlineData ( 40613 ) ]
109- [ InlineData ( 42108 ) ]
110- [ InlineData ( 42109 ) ]
111- [ PlatformSpecific ( TestPlatforms . Windows ) ]
112- public void TransientFaultDisabledTestAsync ( uint errorCode )
113- {
114- using TransientFaultTDSServer server = TransientFaultTDSServer . StartTestServer ( true , true , errorCode ) ;
115- SqlConnectionStringBuilder builder = new ( )
116- {
117- DataSource = "localhost," + server . Port ,
118- IntegratedSecurity = true ,
119- ConnectRetryCount = 0 ,
120- Encrypt = SqlConnectionEncryptOption . Optional
121- } ;
122-
123- using SqlConnection connection = new ( builder . ConnectionString ) ;
124- Task < SqlException > e = Assert . ThrowsAsync < SqlException > ( async ( ) => await connection . OpenAsync ( ) ) ;
125- Assert . Equal ( 20 , e . Result . Class ) ;
126- Assert . Equal ( ConnectionState . Closed , connection . State ) ;
127- }
128-
129- [ ConditionalTheory ( typeof ( TestUtility ) , nameof ( TestUtility . IsNotArmProcess ) ) ]
130- [ InlineData ( 40613 ) ]
131- [ InlineData ( 42108 ) ]
132- [ InlineData ( 42109 ) ]
133- [ PlatformSpecific ( TestPlatforms . Windows ) ]
134- public void TransientFaultDisabledTest ( uint errorCode )
135- {
136- using TransientFaultTDSServer server = TransientFaultTDSServer . StartTestServer ( true , true , errorCode ) ;
137- SqlConnectionStringBuilder builder = new ( )
138- {
139- DataSource = "localhost," + server . Port ,
140- IntegratedSecurity = true ,
141- ConnectRetryCount = 0 ,
142- Encrypt = SqlConnectionEncryptOption . Optional
143- } ;
144-
145- using SqlConnection connection = new ( builder . ConnectionString ) ;
146- SqlException e = Assert . Throws < SqlException > ( ( ) => connection . Open ( ) ) ;
147- Assert . Equal ( 20 , e . Class ) ;
148- Assert . Equal ( ConnectionState . Closed , connection . State ) ;
149- }
150-
15191 [ Fact ]
15292 public void SqlConnectionDbProviderFactoryTest ( )
15393 {
0 commit comments