@@ -1206,13 +1206,23 @@ public void TestWTimeout_Range()
1206
1206
builder . WTimeout = TimeSpan . FromSeconds ( 1 ) ;
1207
1207
}
1208
1208
1209
- [ Fact ]
1210
- public void TestToString_WithSrvSpecified_ParsedSameConnectionString ( )
1211
- {
1212
- const string connectionString = "mongodb+srv://localhost" ;
1213
- var builder = new MongoUrlBuilder ( connectionString ) ;
1214
- var builder2 = new MongoUrlBuilder ( builder . ToString ( ) ) ;
1215
- Assert . Equal ( builder . ToString ( ) , builder2 . ToString ( ) ) ;
1209
+ [ Theory ]
1210
+ [ InlineData ( "mongodb://localhost" , "mongodb://localhost" ) ]
1211
+ [ InlineData ( "mongodb://localhost/?ssl=false" , "mongodb://localhost" ) ]
1212
+ [ InlineData ( "mongodb://localhost/?ssl=true" , "mongodb://localhost/?ssl=true" ) ]
1213
+ [ InlineData ( "mongodb://localhost:27018" , "mongodb://localhost:27018" ) ]
1214
+ [ InlineData ( "mongodb://localhost:27018/?ssl=false" , "mongodb://localhost:27018" ) ]
1215
+ [ InlineData ( "mongodb://localhost:27018/?ssl=true" , "mongodb://localhost:27018/?ssl=true" ) ]
1216
+ [ InlineData ( "mongodb+srv://localhost" , "mongodb+srv://localhost" ) ]
1217
+ [ InlineData ( "mongodb+srv://localhost/?ssl=false" , "mongodb+srv://localhost/?ssl=false" ) ]
1218
+ [ InlineData ( "mongodb+srv://localhost/?ssl=true" , "mongodb+srv://localhost" ) ]
1219
+ public void ToString_should_return_expected_result_for_scheme_port_and_ssl ( string connectionString , string expectedResult )
1220
+ {
1221
+ var subject = new MongoUrlBuilder ( connectionString ) ;
1222
+
1223
+ var result = subject . ToString ( ) ;
1224
+
1225
+ result . Should ( ) . Be ( expectedResult ) ;
1216
1226
}
1217
1227
1218
1228
// private methods
0 commit comments