@@ -25,22 +25,30 @@ namespace MongoDB.Driver.Tests.Specifications.socks5_support
25
25
[ Trait ( "Category" , "Integration" ) ]
26
26
public class Socks5SupportProseTests ( ITestOutputHelper testOutputHelper ) : LoggableTestClass ( testOutputHelper )
27
27
{
28
- //TODO Need be sure that the connection string tests are run.
29
-
30
-
31
28
[ Theory ]
32
- [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&directConnection=true" , false ) ]
33
- [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&directConnection=true" , true ) ]
34
- [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1080" , false ) ]
35
- [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081" , true ) ]
36
- [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&proxyUsername=nonexistentuser&proxyPassword=badauth&directConnection=true" , false ) ]
37
- [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&proxyUsername=nonexistentuser&proxyPassword=badauth&directConnection=true" , true ) ]
38
- [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081&proxyUsername=nonexistentuser&proxyPassword=badauth" , true ) ]
39
- [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&proxyUsername=username&proxyPassword=p4ssw0rd&directConnection=true" , true ) ]
40
- [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&directConnection=true" , true ) ]
41
- [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1080&proxyUsername=username&proxyPassword=p4ssw0rd" , true ) ]
42
- [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081" , true ) ]
43
- public async Task TestConnectionStrings ( string connectionString , bool expectedResult )
29
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&directConnection=true" , false , false ) ]
30
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&directConnection=true" , false , true ) ]
31
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&directConnection=true" , true , false ) ]
32
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&directConnection=true" , true , true ) ]
33
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1080" , false , false ) ]
34
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1080" , false , true ) ]
35
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081" , true , false ) ]
36
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081" , true , true ) ]
37
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&proxyUsername=nonexistentuser&proxyPassword=badauth&directConnection=true" , false , false ) ]
38
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&proxyUsername=nonexistentuser&proxyPassword=badauth&directConnection=true" , false , true ) ]
39
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&proxyUsername=nonexistentuser&proxyPassword=badauth&directConnection=true" , true , false ) ]
40
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&proxyUsername=nonexistentuser&proxyPassword=badauth&directConnection=true" , true , true ) ]
41
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081&proxyUsername=nonexistentuser&proxyPassword=badauth" , true , false ) ]
42
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081&proxyUsername=nonexistentuser&proxyPassword=badauth" , true , true ) ]
43
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&proxyUsername=username&proxyPassword=p4ssw0rd&directConnection=true" , true , false ) ]
44
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1080&proxyUsername=username&proxyPassword=p4ssw0rd&directConnection=true" , true , true ) ]
45
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&directConnection=true" , true , false ) ]
46
+ [ InlineData ( "mongodb://<mappedhost>/?proxyHost=localhost&proxyPort=1081&directConnection=true" , true , true ) ]
47
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1080&proxyUsername=username&proxyPassword=p4ssw0rd" , true , false ) ]
48
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1080&proxyUsername=username&proxyPassword=p4ssw0rd" , true , true ) ]
49
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081" , true , false ) ]
50
+ [ InlineData ( "mongodb://<replicaset>/?proxyHost=localhost&proxyPort=1081" , true , true ) ]
51
+ public async Task TestConnectionStrings ( string connectionString , bool expectedResult , bool async )
44
52
{
45
53
connectionString = connectionString . Replace ( "<mappedhost>" , "localhost:27017" ) . Replace ( "<replicaset>" , "localhost:27017" ) ;
46
54
var mongoClientSettings = MongoClientSettings . FromConnectionString ( connectionString ) ;
@@ -50,14 +58,21 @@ public async Task TestConnectionStrings(string connectionString, bool expectedRe
50
58
var database = client . GetDatabase ( "admin" ) ;
51
59
var command = new BsonDocument ( "hello" , 1 ) ;
52
60
61
+
53
62
if ( expectedResult )
54
63
{
55
- var result = await database . RunCommandAsync < BsonDocument > ( command ) ;
64
+ var result = async
65
+ ? await database . RunCommandAsync < BsonDocument > ( command )
66
+ : database . RunCommand < BsonDocument > ( command ) ;
67
+
56
68
Assert . NotEmpty ( result ) ;
57
69
}
58
70
else
59
71
{
60
- var exception = Record . Exception ( ( ) => database . RunCommand < BsonDocument > ( command ) ) ;
72
+ var exception = async
73
+ ? await Record . ExceptionAsync ( ( ) => database . RunCommandAsync < BsonDocument > ( command ) )
74
+ : Record . Exception ( ( ) => database . RunCommand < BsonDocument > ( command ) ) ;
75
+
61
76
Assert . IsType < TimeoutException > ( exception ) ;
62
77
}
63
78
0 commit comments