@@ -102,7 +102,7 @@ public void ChunkSizeBytes_set_should_throw_when_value_is_invalid(
102
102
public void constructor_with_immutable_other_should_initialize_instance ( )
103
103
{
104
104
var mutable = new GridFSBucketOptions { BucketName = "bucket" , ChunkSizeBytes = 123 , ReadPreference = ReadPreference . Secondary , WriteConcern = WriteConcern . WMajority } ;
105
- var other = mutable . ToImmutable ( ) ;
105
+ var other = new ImmutableGridFSBucketOptions ( mutable ) ;
106
106
107
107
var result = new GridFSBucketOptions ( other ) ;
108
108
@@ -156,19 +156,6 @@ public void ReadPreference_set_should_have_expected_result()
156
156
subject . ReadPreference . Should ( ) . Be ( ReadPreference . Secondary ) ;
157
157
}
158
158
159
- [ Test ]
160
- public void ToImmutable_should_return_expected_result ( )
161
- {
162
- var subject = new GridFSBucketOptions { BucketName = "bucket" , ChunkSizeBytes = 123 , ReadPreference = ReadPreference . Secondary , WriteConcern = WriteConcern . WMajority } ;
163
-
164
- var result = subject . ToImmutable ( ) ;
165
-
166
- result . BucketName . Should ( ) . Be ( subject . BucketName ) ;
167
- result . ChunkSizeBytes . Should ( ) . Be ( subject . ChunkSizeBytes ) ;
168
- result . ReadPreference . Should ( ) . Be ( subject . ReadPreference ) ;
169
- result . WriteConcern . Should ( ) . Be ( subject . WriteConcern ) ;
170
- }
171
-
172
159
[ Test ]
173
160
public void WriteConcern_get_should_return_expected_result ( )
174
161
{
@@ -196,7 +183,7 @@ public class ImmutableGridFSBucketOptionsTests
196
183
[ Test ]
197
184
public void BucketName_get_should_return_expected_result ( )
198
185
{
199
- var subject = new GridFSBucketOptions { BucketName = "bucket" } . ToImmutable ( ) ;
186
+ var subject = new ImmutableGridFSBucketOptions ( new GridFSBucketOptions { BucketName = "bucket" } ) ;
200
187
201
188
var result = subject . BucketName ;
202
189
@@ -206,7 +193,7 @@ public void BucketName_get_should_return_expected_result()
206
193
[ Test ]
207
194
public void ChunkSizeBytes_get_should_return_expected_result ( )
208
195
{
209
- var subject = new GridFSBucketOptions { ChunkSizeBytes = 123 } . ToImmutable ( ) ;
196
+ var subject = new ImmutableGridFSBucketOptions ( new GridFSBucketOptions { ChunkSizeBytes = 123 } ) ;
210
197
211
198
var result = subject . ChunkSizeBytes ;
212
199
@@ -216,7 +203,9 @@ public void ChunkSizeBytes_get_should_return_expected_result()
216
203
[ Test ]
217
204
public void constructor_with_arguments_should_initialize_instance ( )
218
205
{
219
- var result = new ImmutableGridFSBucketOptions ( "bucket" , 123 , ReadPreference . Secondary , WriteConcern . WMajority ) ;
206
+ var mutable = new GridFSBucketOptions { BucketName = "bucket" , ChunkSizeBytes = 123 , ReadPreference = ReadPreference . Secondary , WriteConcern = WriteConcern . WMajority } ;
207
+
208
+ var result = new ImmutableGridFSBucketOptions ( mutable ) ;
220
209
221
210
result . BucketName . Should ( ) . Be ( "bucket" ) ;
222
211
result . ChunkSizeBytes . Should ( ) . Be ( 123 ) ;
@@ -255,46 +244,20 @@ public void Defaults_get_should_return_expected_result()
255
244
result . WriteConcern . Should ( ) . BeNull ( ) ;
256
245
}
257
246
258
- [ Test ]
259
- public void implicit_conversion_from_mutable_should_return_expected_result ( )
260
- {
261
- var mutable = new GridFSBucketOptions { BucketName = "bucket" , ChunkSizeBytes = 123 , ReadPreference = ReadPreference . Secondary , WriteConcern = WriteConcern . WMajority } ;
262
-
263
- var result = ( ImmutableGridFSBucketOptions ) mutable ;
264
-
265
- result . BucketName . Should ( ) . Be ( mutable . BucketName ) ;
266
- result . ChunkSizeBytes . Should ( ) . Be ( mutable . ChunkSizeBytes ) ;
267
- result . ReadPreference . Should ( ) . Be ( mutable . ReadPreference ) ;
268
- result . WriteConcern . Should ( ) . Be ( mutable . WriteConcern ) ;
269
- }
270
-
271
247
[ Test ]
272
248
public void ReadPreference_get_should_return_expected_result ( )
273
249
{
274
- var subject = new GridFSBucketOptions { ReadPreference = ReadPreference . Secondary } . ToImmutable ( ) ;
250
+ var subject = new ImmutableGridFSBucketOptions ( new GridFSBucketOptions { ReadPreference = ReadPreference . Secondary } ) ;
275
251
276
252
var result = subject . ReadPreference ;
277
253
278
254
result . Should ( ) . Be ( ReadPreference . Secondary ) ;
279
255
}
280
256
281
- [ Test ]
282
- public void ToMutable_should_return_expected_result ( )
283
- {
284
- var subject = new GridFSBucketOptions { BucketName = "bucket" , ChunkSizeBytes = 123 , ReadPreference = ReadPreference . Secondary , WriteConcern = WriteConcern . WMajority } . ToImmutable ( ) ;
285
-
286
- var result = subject . ToMutable ( ) ;
287
-
288
- result . BucketName . Should ( ) . Be ( subject . BucketName ) ;
289
- result . ChunkSizeBytes . Should ( ) . Be ( subject . ChunkSizeBytes ) ;
290
- result . ReadPreference . Should ( ) . Be ( subject . ReadPreference ) ;
291
- result . WriteConcern . Should ( ) . Be ( subject . WriteConcern ) ;
292
- }
293
-
294
257
[ Test ]
295
258
public void WriteConcern_get_should_return_expected_result ( )
296
259
{
297
- var subject = new GridFSBucketOptions { WriteConcern = WriteConcern . WMajority } . ToImmutable ( ) ;
260
+ var subject = new ImmutableGridFSBucketOptions ( new GridFSBucketOptions { WriteConcern = WriteConcern . WMajority } ) ;
298
261
299
262
var result = subject . WriteConcern ;
300
263
0 commit comments