@@ -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 {
@@ -77,17 +77,20 @@ public void GetOrCreateCluster_should_return_a_cluster_with_the_correct_settings
7777
7878 using ( var cluster = subject . GetOrCreateCluster ( clientSettings . ToClusterKey ( ) ) )
7979 {
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+ } ;
8286 cluster . Settings . ConnectionMode . Should ( ) . Be ( ClusterConnectionMode . ReplicaSet ) ;
8387 cluster . Settings . EndPoints . Equals ( endPoints ) ;
8488 cluster . Settings . ReplicaSetName . Should ( ) . Be ( "rs" ) ;
8589 cluster . Settings . ServerSelectionTimeout . Should ( ) . Be ( clientSettings . ServerSelectionTimeout ) ;
8690 cluster . Settings . PostServerSelector . Should ( ) . NotBeNull ( ) . And . Subject . Should ( ) . BeOfType < LatencyLimitingServerSelector > ( ) ;
8791 cluster . Settings . MaxServerSelectionWaitQueueSize . Should ( ) . Be ( 20 ) ;
8892
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 ) ;
9194
9295 // TODO: don't know how to test the rest of the settings because they are all private to the cluster
9396 }
0 commit comments