|
14 | 14 | */
|
15 | 15 |
|
16 | 16 | using System;
|
| 17 | +using System.Collections.Generic; |
17 | 18 | using System.Linq;
|
18 | 19 | using System.Net.Sockets;
|
19 | 20 | using System.Security.Authentication;
|
| 21 | +using System.Text; |
20 | 22 | using System.Threading;
|
21 | 23 | using FluentAssertions;
|
22 | 24 | using Microsoft.Extensions.Logging;
|
23 | 25 | using MongoDB.Bson;
|
| 26 | +using MongoDB.Bson.IO; |
24 | 27 | using MongoDB.Bson.TestHelpers.XunitExtensions;
|
25 | 28 | using MongoDB.Driver.Core.Clusters;
|
26 | 29 | using MongoDB.Driver.Core.Compression;
|
27 | 30 | using MongoDB.Driver.Core.Configuration;
|
28 | 31 | using MongoDB.Driver.Core.TestHelpers.XunitExtensions;
|
| 32 | +using MongoDB.Driver.Encryption; |
29 | 33 | using Moq;
|
30 | 34 | using Xunit;
|
31 | 35 |
|
@@ -550,6 +554,27 @@ public void TestEquals()
|
550 | 554 | clone.SdamLogFilename = "garbage";
|
551 | 555 | #pragma warning restore CS0618 // Type or member is obsolete
|
552 | 556 | Assert.False(clone.Equals(settings));
|
| 557 | + |
| 558 | + // set non default values |
| 559 | + settings.AutoEncryptionOptions = new AutoEncryptionOptions(CollectionNamespace.FromFullName("encryption.__keyVault"), new Dictionary<string, IReadOnlyDictionary<string, object>>()); |
| 560 | + settings.LoggingSettings = new LoggingSettings(null, 123); |
| 561 | + settings.ReadConcern = ReadConcern.Majority; |
| 562 | + settings.ReadEncoding = new UTF8Encoding(false, false); |
| 563 | + settings.ServerApi = new ServerApi(ServerApiVersion.V1); |
| 564 | + settings.WriteConcern = WriteConcern.W2; |
| 565 | + settings.WriteEncoding = new UTF8Encoding(false, false); |
| 566 | + |
| 567 | + clone = settings.Clone(); |
| 568 | + clone.AutoEncryptionOptions = clone.AutoEncryptionOptions.With(bypassAutoEncryption: settings.AutoEncryptionOptions.BypassAutoEncryption); |
| 569 | + clone.LoggingSettings = new LoggingSettings(null, settings.LoggingSettings.MaxDocumentSize); |
| 570 | + clone.ReadConcern = ReadConcern.FromBsonDocument(settings.ReadConcern.ToBsonDocument()); |
| 571 | + clone.ReadEncoding = new UTF8Encoding(false, false); |
| 572 | + clone.ReadPreference = clone.ReadPreference.With(settings.ReadPreference.ReadPreferenceMode); |
| 573 | + clone.ServerApi = new ServerApi(settings.ServerApi.Version); |
| 574 | + clone.WriteConcern = WriteConcern.FromBsonDocument(settings.WriteConcern.ToBsonDocument()); |
| 575 | + clone.WriteEncoding = new UTF8Encoding(false, false); |
| 576 | + |
| 577 | + Assert.True(clone.Equals(settings)); |
553 | 578 | }
|
554 | 579 |
|
555 | 580 | [Fact]
|
|
0 commit comments