File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
src/MongoDB.Driver.Core/Core/Configuration
tests/MongoDB.Driver.Core.Tests/Core/Configuration Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ public ClusterSettings(
9999 _endPoints = Ensure . IsNotNull ( endPoints . WithDefault ( __defaultEndPoints ) , "endPoints" ) . ToList ( ) ;
100100 _kmsProviders = kmsProviders . WithDefault ( null ) ;
101101 _loadBalanced = loadBalanced . WithDefault ( false ) ;
102- _localThreshold = Ensure . IsGreaterThanOrEqualToZero ( localThreshold . WithDefault ( TimeSpan . FromMilliseconds ( 15 ) ) , "localThreshold" ) ;
102+ _localThreshold = Ensure . IsInfiniteOrGreaterThanOrEqualToZero ( localThreshold . WithDefault ( TimeSpan . FromMilliseconds ( 15 ) ) , "localThreshold" ) ;
103103 _maxServerSelectionWaitQueueSize = Ensure . IsGreaterThanOrEqualToZero ( maxServerSelectionWaitQueueSize . WithDefault ( 500 ) , "maxServerSelectionWaitQueueSize" ) ;
104104 _replicaSetName = replicaSetName . WithDefault ( null ) ;
105105 _serverApi = serverApi . WithDefault ( null ) ;
Original file line number Diff line number Diff line change 1515
1616using System ;
1717using System . Net ;
18+ using System . Threading ;
1819using FluentAssertions ;
1920using MongoDB . Bson . TestHelpers . EqualityComparers ;
2021using MongoDB . Driver . Core . Clusters ;
@@ -153,6 +154,22 @@ public void constructor_with_locadBalanced_should_initialize_instance()
153154 subject . ServerSelectionTimeout . Should ( ) . Be ( __defaults . ServerSelectionTimeout ) ;
154155 }
155156
157+ [ Fact ]
158+ public void constructor_with_infinite_localThreshold_should_initialize_instance ( )
159+ {
160+ #pragma warning disable CS0618 // Type or member is obsolete
161+ var subject = new ClusterSettings ( localThreshold : Timeout . InfiniteTimeSpan ) ;
162+ subject . ConnectionMode . Should ( ) . Be ( __defaults . ConnectionMode ) ;
163+ #pragma warning restore CS0618 // Type or member is obsolete
164+ subject . EndPoints . Should ( ) . EqualUsing ( __defaults . EndPoints , EndPointHelper . EndPointEqualityComparer ) ;
165+ subject . LoadBalanced . Should ( ) . BeFalse ( ) ;
166+ subject . LocalThreshold . Should ( ) . Be ( Timeout . InfiniteTimeSpan ) ;
167+ subject . MaxServerSelectionWaitQueueSize . Should ( ) . Be ( __defaults . MaxServerSelectionWaitQueueSize ) ;
168+ subject . ReplicaSetName . Should ( ) . Be ( __defaults . ReplicaSetName ) ;
169+ subject . Scheme . Should ( ) . Be ( __defaults . Scheme ) ;
170+ subject . ServerSelectionTimeout . Should ( ) . Be ( __defaults . ServerSelectionTimeout ) ;
171+ }
172+
156173 [ Fact ]
157174 public void constructor_with_localThreshold_should_initialize_instance ( )
158175 {
You can’t perform that action at this time.
0 commit comments