@@ -506,6 +506,57 @@ public void TestConnectionMapPropertiesWithSpecialCharacters(string passwordValu
506506 // Assert
507507 Assert . AreEqual ( expectedValue , properties [ SFSessionProperty . PASSWORD ] ) ;
508508 }
509+
510+ [ Test ]
511+ public void TestConnectionWithCompleteSPCSConfiguration( )
512+ {
513+ // Arrange
514+ var tokenFilePath = "/path/to/token" ;
515+ var testToken = "oauth_token_12345" ;
516+ var mockFileOperations = new Mock < FileOperations > ( ) ;
517+ var mockEnvironmentOperations = new Mock < EnvironmentOperations > ( ) ;
518+ mockEnvironmentOperations . Setup ( e => e . GetFolderPath ( Environment . SpecialFolder . UserProfile ) )
519+ . Returns ( $ "{ Path . DirectorySeparatorChar } home") ;
520+ mockFileOperations . Setup ( f => f . Exists ( It . IsAny < string > ( ) ) ) . Returns ( true ) ;
521+ mockFileOperations . Setup ( f => f . ReadAllText ( tokenFilePath , It . IsAny < Action < UnixStream > > ( ) ) ) . Returns ( testToken ) ;
522+ mockFileOperations . Setup ( f => f . ReadAllText ( It . Is < string > ( p => p . Contains ( ".snowflake" ) ) , It . IsAny < Action < UnixStream > > ( ) ) )
523+ . Returns ( @$ "
524+ [default]
525+ host = 'host.snowflake.com'
526+ protocol = 'http'
527+ port = 80
528+ account = 'account123'
529+ database = 'testdb'
530+ schema = 'testschema'
531+ warehouse = 'testwh'
532+ authenticator = 'oauth'
533+ token_file_path = '{ tokenFilePath } '
534+ client_session_keep_alive = true
535+ ocsp_fail_open = true
536+ disable_ocsp_check = true
537+ " ) ;
538+
539+ var reader = new TomlConnectionBuilder( mockFileOperations . Object , mockEnvironmentOperations . Object ) ;
540+
541+ // Act
542+ var connectionString = reader. GetConnectionStringFromToml ( ) ;
543+ var properties = SFSessionProperties. ParseConnectionString ( connectionString , new SessionPropertiesContext ( ) ) ;
544+
545+ // Assert
546+ Assert. Multiple ( ( ) =>
547+ {
548+ Assert . AreEqual ( "host.snowflake.com" , properties [ SFSessionProperty . HOST ] ) ;
549+ Assert . AreEqual ( "http" , properties [ SFSessionProperty . SCHEME ] ) ;
550+ Assert . AreEqual ( "80" , properties [ SFSessionProperty . PORT ] ) ;
551+ Assert . AreEqual ( "account123" , properties [ SFSessionProperty . ACCOUNT ] ) ;
552+ Assert . AreEqual ( "testdb" , properties [ SFSessionProperty . DB ] ) ;
553+ Assert . AreEqual ( "testschema" , properties [ SFSessionProperty . SCHEMA ] ) ;
554+ Assert . AreEqual ( "testwh" , properties [ SFSessionProperty . WAREHOUSE ] ) ;
555+ Assert . AreEqual ( "oauth" , properties [ SFSessionProperty . AUTHENTICATOR ] ) ;
556+ Assert . AreEqual ( testToken , properties [ SFSessionProperty . TOKEN ] ) ;
557+ Assert . AreEqual ( "true" , properties [ SFSessionProperty . CLIENT_SESSION_KEEP_ALIVE ] ) ;
558+ } ) ;
559+ }
509560 }
510561
511562}
0 commit comments