@@ -12,4 +12,103 @@ public void EndpointIsNullByDefault() =>
1212 [ Fact ]
1313 public void CredentialsIsNullByDefault ( ) =>
1414 Assert . Null ( new MinioClientSettings ( ) . Credentials ) ;
15+
16+ [ Fact ]
17+ public void UseSslIsFalseByDefault ( )
18+ {
19+ var settings = new MinioClientSettings ( ) ;
20+ Assert . False ( settings . UseSsl ) ;
21+ }
22+
23+ [ Fact ]
24+ public void ParseConnectionString_HttpsUri_DoesNotInferUseSsl ( )
25+ {
26+ var settings = new MinioClientSettings ( ) ;
27+ settings . ParseConnectionString ( "https://minio.example.com:9000" ) ;
28+
29+ Assert . NotNull ( settings . Endpoint ) ;
30+ Assert . Equal ( "https://minio.example.com:9000/" , settings . Endpoint . ToString ( ) ) ;
31+ Assert . False ( settings . UseSsl ) ; // Should remain false since UseSsl was not explicitly set
32+ }
33+
34+ [ Fact ]
35+ public void ParseConnectionString_HttpUri_DoesNotInferUseSsl ( )
36+ {
37+ var settings = new MinioClientSettings ( ) ;
38+ settings . ParseConnectionString ( "http://minio.example.com:9000" ) ;
39+
40+ Assert . NotNull ( settings . Endpoint ) ;
41+ Assert . Equal ( "http://minio.example.com:9000/" , settings . Endpoint . ToString ( ) ) ;
42+ Assert . False ( settings . UseSsl ) ; // Should remain false
43+ }
44+
45+ [ Fact ]
46+ public void ParseConnectionString_ExplicitUseSslTrue ( )
47+ {
48+ var settings = new MinioClientSettings ( ) ;
49+ settings . ParseConnectionString ( "Endpoint=http://minio.example.com:9000;UseSsl=true;AccessKey=key;SecretKey=secret" ) ;
50+
51+ Assert . NotNull ( settings . Endpoint ) ;
52+ Assert . True ( settings . UseSsl ) ;
53+ }
54+
55+ [ Fact ]
56+ public void ParseConnectionString_ExplicitUseSslFalse ( )
57+ {
58+ var settings = new MinioClientSettings ( ) ;
59+ settings . ParseConnectionString ( "Endpoint=https://minio.example.com:9000;UseSsl=false;AccessKey=key;SecretKey=secret" ) ;
60+
61+ Assert . NotNull ( settings . Endpoint ) ;
62+ Assert . False ( settings . UseSsl ) ;
63+ }
64+
65+ [ Fact ]
66+ public void ParseConnectionString_UseSslCaseInsensitive ( )
67+ {
68+ var settings = new MinioClientSettings ( ) ;
69+ settings . ParseConnectionString ( "Endpoint=http://minio.example.com:9000;UseSsl=True;AccessKey=key;SecretKey=secret" ) ;
70+
71+ Assert . True ( settings . UseSsl ) ;
72+ }
73+
74+
75+ [ Fact ]
76+ public void ParseConnectionString_WithCredentials ( )
77+ {
78+ var settings = new MinioClientSettings ( ) ;
79+ settings . ParseConnectionString ( "Endpoint=http://minio.example.com:9000;AccessKey=mykey;SecretKey=mysecret;UseSsl=true" ) ;
80+
81+ Assert . NotNull ( settings . Endpoint ) ;
82+ Assert . NotNull ( settings . Credentials ) ;
83+ Assert . Equal ( "mykey" , settings . Credentials . AccessKey ) ;
84+ Assert . Equal ( "mysecret" , settings . Credentials . SecretKey ) ;
85+ Assert . True ( settings . UseSsl ) ;
86+ }
87+
88+ [ Fact ]
89+ public void ParseConnectionString_NullOrEmpty_DoesNotThrow ( )
90+ {
91+ var settings = new MinioClientSettings ( ) ;
92+ settings . ParseConnectionString ( null ) ;
93+ Assert . Null ( settings . Endpoint ) ;
94+
95+ settings = new MinioClientSettings ( ) ;
96+ settings . ParseConnectionString ( "" ) ;
97+ Assert . Null ( settings . Endpoint ) ;
98+
99+ settings = new MinioClientSettings ( ) ;
100+ settings . ParseConnectionString ( " " ) ;
101+ Assert . Null ( settings . Endpoint ) ;
102+ }
103+
104+ [ Fact ]
105+ public void ParseConnectionString_HttpsEndpointInConnectionString_DoesNotInferUseSsl ( )
106+ {
107+ var settings = new MinioClientSettings ( ) ;
108+ settings . ParseConnectionString ( "Endpoint=https://minio.example.com:9000;AccessKey=key;SecretKey=secret" ) ;
109+
110+ Assert . NotNull ( settings . Endpoint ) ;
111+ Assert . Equal ( "https://minio.example.com:9000/" , settings . Endpoint . ToString ( ) ) ;
112+ Assert . False ( settings . UseSsl ) ; // Should remain false without explicit UseSsl
113+ }
15114}
0 commit comments