@@ -42,7 +42,7 @@ public void Instance_should_return_the_same_instance_every_time()
42
42
public void GetOrCreateCluster_should_return_a_cluster_with_the_correct_settings ( )
43
43
{
44
44
var credentials = new [ ] { MongoCredential . CreateMongoCRCredential ( "source" , "username" , "password" ) } ;
45
- var servers = new [ ] { new MongoServerAddress ( "localhost" ) } ;
45
+ var servers = new [ ] { new MongoServerAddress ( "localhost" ) , new MongoServerAddress ( "127.0.0.1" , 30000 ) , new MongoServerAddress ( "[::1]" , 27018 ) } ;
46
46
47
47
var sslSettings = new SslSettings
48
48
{
@@ -77,17 +77,20 @@ public void GetOrCreateCluster_should_return_a_cluster_with_the_correct_settings
77
77
78
78
using ( var cluster = subject . GetOrCreateCluster ( clientSettings . ToClusterKey ( ) ) )
79
79
{
80
- var address = clientSettings . Servers . Single ( ) ;
81
- var endPoints = new [ ] { new DnsEndPoint ( address . Host , address . Port ) } ;
80
+ var endPoints = new EndPoint [ ]
81
+ {
82
+ new DnsEndPoint ( "localhost" , 27017 ) ,
83
+ new IPEndPoint ( IPAddress . Parse ( "127.0.0.1" ) , 30000 ) ,
84
+ new IPEndPoint ( IPAddress . Parse ( "[::1]" ) , 27018 )
85
+ } ;
82
86
cluster . Settings . ConnectionMode . Should ( ) . Be ( ClusterConnectionMode . ReplicaSet ) ;
83
87
cluster . Settings . EndPoints . Equals ( endPoints ) ;
84
88
cluster . Settings . ReplicaSetName . Should ( ) . Be ( "rs" ) ;
85
89
cluster . Settings . ServerSelectionTimeout . Should ( ) . Be ( clientSettings . ServerSelectionTimeout ) ;
86
90
cluster . Settings . PostServerSelector . Should ( ) . NotBeNull ( ) . And . Subject . Should ( ) . BeOfType < LatencyLimitingServerSelector > ( ) ;
87
91
cluster . Settings . MaxServerSelectionWaitQueueSize . Should ( ) . Be ( 20 ) ;
88
92
89
- var serverDescription = cluster . Description . Servers . Single ( s => s . EndPoint . Equals ( endPoints [ 0 ] ) ) ;
90
- serverDescription . EndPoint . Should ( ) . Be ( endPoints [ 0 ] ) ;
93
+ cluster . Description . Servers . Select ( s => s . EndPoint ) . Should ( ) . Contain ( endPoints ) ;
91
94
92
95
// TODO: don't know how to test the rest of the settings because they are all private to the cluster
93
96
}
0 commit comments