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(
99
99
_endPoints = Ensure . IsNotNull ( endPoints . WithDefault ( __defaultEndPoints ) , "endPoints" ) . ToList ( ) ;
100
100
_kmsProviders = kmsProviders . WithDefault ( null ) ;
101
101
_loadBalanced = loadBalanced . WithDefault ( false ) ;
102
- _localThreshold = Ensure . IsGreaterThanOrEqualToZero ( localThreshold . WithDefault ( TimeSpan . FromMilliseconds ( 15 ) ) , "localThreshold" ) ;
102
+ _localThreshold = Ensure . IsInfiniteOrGreaterThanOrEqualToZero ( localThreshold . WithDefault ( TimeSpan . FromMilliseconds ( 15 ) ) , "localThreshold" ) ;
103
103
_maxServerSelectionWaitQueueSize = Ensure . IsGreaterThanOrEqualToZero ( maxServerSelectionWaitQueueSize . WithDefault ( 500 ) , "maxServerSelectionWaitQueueSize" ) ;
104
104
_replicaSetName = replicaSetName . WithDefault ( null ) ;
105
105
_serverApi = serverApi . WithDefault ( null ) ;
Original file line number Diff line number Diff line change 15
15
16
16
using System ;
17
17
using System . Net ;
18
+ using System . Threading ;
18
19
using FluentAssertions ;
19
20
using MongoDB . Bson . TestHelpers . EqualityComparers ;
20
21
using MongoDB . Driver . Core . Clusters ;
@@ -153,6 +154,22 @@ public void constructor_with_locadBalanced_should_initialize_instance()
153
154
subject . ServerSelectionTimeout . Should ( ) . Be ( __defaults . ServerSelectionTimeout ) ;
154
155
}
155
156
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
+
156
173
[ Fact ]
157
174
public void constructor_with_localThreshold_should_initialize_instance ( )
158
175
{
You can’t perform that action at this time.
0 commit comments