@@ -42,7 +42,7 @@ public void Instance_should_return_the_same_instance_every_time()
4242 public void GetOrCreateCluster_should_return_a_cluster_with_the_correct_settings ( )
4343 {
4444 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 ) } ;
4646
4747 var sslSettings = new SslSettings
4848 {
@@ -76,16 +76,19 @@ public void GetOrCreateCluster_should_return_a_cluster_with_the_correct_settings
7676
7777 using ( var cluster = subject . GetOrCreateCluster ( clientSettings . ToClusterKey ( ) ) )
7878 {
79- var address = clientSettings . Servers . Single ( ) ;
80- var endPoints = new [ ] { new DnsEndPoint ( address . Host , address . Port ) } ;
79+ var endPoints = new EndPoint [ ]
80+ {
81+ new DnsEndPoint ( "localhost" , 27017 ) ,
82+ new IPEndPoint ( IPAddress . Parse ( "127.0.0.1" ) , 30000 ) ,
83+ new IPEndPoint ( IPAddress . Parse ( "[::1]" ) , 27018 )
84+ } ;
8185 cluster . Settings . ConnectionMode . Should ( ) . Be ( ClusterConnectionMode . ReplicaSet ) ;
8286 cluster . Settings . EndPoints . Equals ( endPoints ) ;
8387 cluster . Settings . ReplicaSetName . Should ( ) . Be ( "rs" ) ;
8488 cluster . Settings . PostServerSelector . Should ( ) . NotBeNull ( ) . And . Subject . Should ( ) . BeOfType < LatencyLimitingServerSelector > ( ) ;
8589 cluster . Settings . MaxServerSelectionWaitQueueSize . Should ( ) . Be ( 20 ) ;
8690
87- var serverDescription = cluster . Description . Servers . Single ( s => s . EndPoint . Equals ( endPoints [ 0 ] ) ) ;
88- serverDescription . EndPoint . Should ( ) . Be ( endPoints [ 0 ] ) ;
91+ cluster . Description . Servers . Select ( s => s . EndPoint ) . Should ( ) . Contain ( endPoints ) ;
8992
9093 // TODO: don't know how to test the rest of the settings because they are all private to the cluster
9194 }
0 commit comments