@@ -901,51 +901,5 @@ public void TestConnWithUserAgentFeatureExtension(bool sendAck)
901901
902902 // TODO: Confirm the server sent an Ack by reading log message from SqlInternalConnectionTds
903903 }
904-
905- /// <summary>
906- /// Test to verify no UserAgent relevant information is sent when EnableUserAgentField switch is disabled.
907- /// </summary>
908- [ Fact ]
909- public void TestConnWithoutUserAgentFeatureExtension ( )
910- {
911- using var server = new TdsServer ( ) ;
912- server . Start ( ) ;
913-
914- // Do not advertise or force the UserAgent feature on the server
915- server . ServerSupportedUserAgentFeatureExtVersion = 0x00 ; // no support
916- server . EnableUserAgentFeatureExt = false ; // no forced ACK
917-
918- bool loginValidated = false ;
919- bool userAgentFeatureSeen = false ;
920-
921- // Inspect the LOGIN7 packet captured by the test server
922- server . OnLogin7Validated = loginToken =>
923- {
924- var featureExtTokens = loginToken . FeatureExt
925- . OfType < TDSLogin7GenericOptionToken > ( )
926- . ToArray ( ) ;
927-
928- // Ensure there is no UserAgentSupport token at all
929- var uaToken = featureExtTokens . FirstOrDefault ( t => t . FeatureID == TDSFeatureID . UserAgentSupport ) ;
930- userAgentFeatureSeen = uaToken is not null ;
931-
932- loginValidated = true ;
933- } ;
934-
935- // Connect to the test TDS server with a basic connection string
936- var connStr = new SqlConnectionStringBuilder
937- {
938- DataSource = $ "localhost,{ server . EndPoint . Port } ",
939- Encrypt = SqlConnectionEncryptOption . Optional ,
940- } . ConnectionString ;
941-
942- using var connection = new SqlConnection ( connStr ) ;
943- connection . Open ( ) ;
944-
945- // Verify that the connection succeeded and no UserAgent data was sent
946- Assert . Equal ( ConnectionState . Open , connection . State ) ;
947- Assert . True ( loginValidated , "Expected LOGIN7 to be validated by the test server" ) ;
948- Assert . False ( userAgentFeatureSeen , "Did not expect a UserAgentSupport feature token in LOGIN7" ) ;
949- }
950904 }
951905}
0 commit comments