From cd7f0dcda4f56d92c04f23b663a5c65496b56664 Mon Sep 17 00:00:00 2001 From: adelinowona Date: Fri, 6 Jun 2025 16:03:26 -0400 Subject: [PATCH] CSHARP-5610: Cleanup unnecessary whitespaces in the codebase --- .../MongoDB.Driver.Benchmarks/BenchmarkResult.cs | 2 +- .../DriverBenchmarkCategory.cs | 2 +- .../MultiDoc/BulkWriteMixedOpsBenchmark.cs | 10 +++++----- .../MultiDoc/LargeDocBulkInsertBenchmark.cs | 6 +++--- .../MultiDoc/SmallDocBulkInsertBenchmark.cs | 4 ++-- .../DuplicateBsonMemberMapAttributeException.cs | 2 +- src/MongoDB.Bson/IO/BsonBinaryReaderSettings.cs | 4 ++-- src/MongoDB.Bson/IO/ByteBufferStream.cs | 2 +- src/MongoDB.Bson/IO/InputBufferChunkSource.cs | 2 +- .../MaterializedOnDemandBsonDocument.cs | 2 +- .../Serialization/BinaryVectorReader.cs | 2 +- .../Serialization/BinaryVectorWriter.cs | 2 +- .../Serialization/BsonSerializationContext.cs | 2 +- .../Conventions/ConventionRegistry.cs | 4 ++-- .../ImmutableTypeClassMapConvention.cs | 2 +- .../IdGenerators/AscendingGuidGenerator.cs | 4 ++-- .../Serializers/ExpandoObjectSerializer.cs | 2 +- ...merableDeserializingAsCollectionSerializer.cs | 2 +- .../Gssapi/Sspi/EncryptQualityOfProtection.cs | 2 +- .../Authentication/SaslMapParser.cs | 2 +- .../Authentication/SaslPrepHelper.cs | 12 ++++++------ src/MongoDB.Driver/Core/Bindings/CoreSession.cs | 2 +- src/MongoDB.Driver/Core/Clusters/ClusterClock.cs | 2 +- src/MongoDB.Driver/Core/Clusters/ElectionId.cs | 2 +- .../Core/Clusters/IClusterClock.cs | 2 +- .../Core/Compression/ICompressor.cs | 4 ++-- .../Core/Compression/ZlibCompressor.cs | 2 +- .../PerformanceCounterEventSubscriber.cs | 2 +- .../Core/Events/ReflectionEventSubscriber.cs | 2 +- .../StructuredLogTemplateProvidersSdam.cs | 2 +- src/MongoDB.Driver/Core/Misc/BatchableSource.cs | 2 +- .../Core/Misc/SemaphoreSlimRequest.cs | 2 +- .../Operations/FindAndModifyOperationBase.cs | 10 +++++----- src/MongoDB.Driver/Core/ReadConcernLevel.cs | 8 ++++---- src/MongoDB.Driver/ExternalEvidence.cs | 4 ++-- .../GeoJsonObjectModel/GeoJsonCoordinates.cs | 2 +- src/MongoDB.Driver/IMongoIndexManager.cs | 2 +- .../Ast/Expressions/AstRangeExpression.cs | 2 +- .../Ast/Stages/AstMergeStage.cs | 2 +- .../Ast/Stages/AstReplaceRootStage.cs | 2 +- .../Serializers/EnumUnderlyingTypeSerializer.cs | 6 +++--- src/MongoDB.Driver/MongoIdentityEvidence.cs | 2 +- .../Search/SearchAutocompleteTokenOrder.cs | 2 +- .../Search/SearchDefinitionBuilder.cs | 14 +++++++------- .../Search/SearchPathDefinition.cs | 4 ++-- src/MongoDB.Driver/Search/SearchRangeV2.cs | 8 ++++---- src/MongoDB.Driver/WriteModel.cs | 2 +- src/MongoDB.Shared/Hasher.cs | 2 +- .../Threading/ThreadPerTaskScheduler.cs | 16 ++++++++-------- .../Serialization/BsonSerializerTests.cs | 2 +- .../Serializers/BinaryVectorSerializerTests.cs | 4 ++-- .../ReadOnlyDictionarySerializerTests.cs | 2 +- .../HashCallbackTests.cs | 2 +- .../Authentication/SaslPrepHelperTests.cs | 16 ++++++++-------- .../Core/Clusters/DnsMonitorTests.cs | 2 +- .../Configuration/CryptClientSettingsTests.cs | 2 +- .../ConnectionPools/MaintenanceHelperTests.cs | 2 +- .../Operations/DropCollectionOperationTests.cs | 2 +- .../Core/Servers/ServerFactoryTests.cs | 2 +- .../FindExpressionProjectionDefinitionTests.cs | 2 +- .../MongoDB.Driver.Tests/Jira/CSharp4646Tests.cs | 2 +- .../JsonDrivenTargetedFailPointTest.cs | 2 +- ...thodToAggregationExpressionTranslatorTests.cs | 2 +- ...thodToAggregationExpressionTranslatorTests.cs | 2 +- .../Search/AtlasSearchIndexManagmentTests.cs | 14 +++++++------- .../Search/AtlasSearchTests.cs | 16 ++++++++-------- .../Search/SearchDefinitionBuilderTests.cs | 8 ++++---- .../server-selection/InWindowTestRunner.cs | 2 +- .../UnifiedCloseCursorOperation.cs | 2 +- 69 files changed, 136 insertions(+), 136 deletions(-) diff --git a/benchmarks/MongoDB.Driver.Benchmarks/BenchmarkResult.cs b/benchmarks/MongoDB.Driver.Benchmarks/BenchmarkResult.cs index 1eacc5f79d0..8eefeeef684 100644 --- a/benchmarks/MongoDB.Driver.Benchmarks/BenchmarkResult.cs +++ b/benchmarks/MongoDB.Driver.Benchmarks/BenchmarkResult.cs @@ -41,7 +41,7 @@ public BenchmarkResult(BenchmarkReport benchmarkReport) Name = Categories.Contains(DriverBenchmarkCategory.BulkWriteBench) ? benchmarkReport.BenchmarkCase.Descriptor.WorkloadMethod.Name : benchmarkReport.BenchmarkCase.Descriptor.Type.Name; - + dataSetSize = (int)benchmarkReport.BenchmarkCase.Parameters["BenchmarkDataSetSize"]; } diff --git a/benchmarks/MongoDB.Driver.Benchmarks/DriverBenchmarkCategory.cs b/benchmarks/MongoDB.Driver.Benchmarks/DriverBenchmarkCategory.cs index 3bb57045ccc..f8b1db2057f 100644 --- a/benchmarks/MongoDB.Driver.Benchmarks/DriverBenchmarkCategory.cs +++ b/benchmarks/MongoDB.Driver.Benchmarks/DriverBenchmarkCategory.cs @@ -26,7 +26,7 @@ public static class DriverBenchmarkCategory public const string ReadBench = "ReadBench"; public const string SingleBench = "SingleBench"; public const string WriteBench = "WriteBench"; - + // not included in AllCategories as it's not part of the benchmarking spec public const string BulkWriteBench = "BulkWriteBench"; diff --git a/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/BulkWriteMixedOpsBenchmark.cs b/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/BulkWriteMixedOpsBenchmark.cs index bdbf157d64b..d7de47e2e13 100644 --- a/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/BulkWriteMixedOpsBenchmark.cs +++ b/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/BulkWriteMixedOpsBenchmark.cs @@ -48,11 +48,11 @@ public void Setup() for (var i = 0; i < 10000; i++) { var collectionName = __collectionNamespaces[i % __collectionNamespaces.Length]; - + _clientBulkWriteMixedOpsModels.Add(new BulkWriteInsertOneModel(collectionName, smallDocument.DeepClone().AsBsonDocument)); _clientBulkWriteMixedOpsModels.Add(new BulkWriteReplaceOneModel(collectionName, FilterDefinition.Empty, smallDocument.DeepClone().AsBsonDocument)); _clientBulkWriteMixedOpsModels.Add(new BulkWriteDeleteOneModel(collectionName, FilterDefinition.Empty)); - + _collectionBulkWriteMixedOpsModels.Add(new InsertOneModel(smallDocument.DeepClone().AsBsonDocument)); _collectionBulkWriteMixedOpsModels.Add(new ReplaceOneModel(FilterDefinition.Empty, smallDocument.DeepClone().AsBsonDocument)); _collectionBulkWriteMixedOpsModels.Add(new DeleteOneModel(FilterDefinition.Empty)); @@ -63,13 +63,13 @@ public void Setup() public void BeforeTask() { _client.DropDatabase(MongoConfiguration.PerfTestDatabaseName); - + _database = _client.GetDatabase(MongoConfiguration.PerfTestDatabaseName); foreach (var collectionName in __collectionNamespaces) { _database.CreateCollection(collectionName.Split('.')[1]); } - + _collection = _database.GetCollection(MongoConfiguration.PerfTestCollectionName); } @@ -78,7 +78,7 @@ public void SmallDocCollectionBulkWriteMixedOpsBenchmark() { _collection.BulkWrite(_collectionBulkWriteMixedOpsModels, new()); } - + [Benchmark] public void SmallDocClientBulkWriteMixedOpsBenchmark() { diff --git a/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/LargeDocBulkInsertBenchmark.cs b/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/LargeDocBulkInsertBenchmark.cs index 4ed26e65226..32576821996 100644 --- a/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/LargeDocBulkInsertBenchmark.cs +++ b/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/LargeDocBulkInsertBenchmark.cs @@ -32,7 +32,7 @@ public class LargeDocBulkInsertBenchmark private BsonDocument[] _largeDocuments; private InsertOneModel[] _collectionBulkWriteInsertModels; private BulkWriteInsertOneModel[] _clientBulkWriteInsertModels; - + private static readonly CollectionNamespace __collectionNamespace = CollectionNamespace.FromFullName($"{MongoConfiguration.PerfTestDatabaseName}.{MongoConfiguration.PerfTestCollectionName}"); @@ -63,13 +63,13 @@ public void InsertManyLargeBenchmark() { _collection.InsertMany(_largeDocuments, new()); } - + [Benchmark] public void LargeDocCollectionBulkWriteInsertBenchmark() { _collection.BulkWrite(_collectionBulkWriteInsertModels, new()); } - + [Benchmark] public void LargeDocClientBulkWriteInsertBenchmark() { diff --git a/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/SmallDocBulkInsertBenchmark.cs b/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/SmallDocBulkInsertBenchmark.cs index a1d62e26038..a932541575f 100644 --- a/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/SmallDocBulkInsertBenchmark.cs +++ b/benchmarks/MongoDB.Driver.Benchmarks/MultiDoc/SmallDocBulkInsertBenchmark.cs @@ -62,13 +62,13 @@ public void InsertManySmallBenchmark() { _collection.InsertMany(_smallDocuments, new()); } - + [Benchmark] public void SmallDocCollectionBulkWriteInsertBenchmark() { _collection.BulkWrite(_collectionBulkWriteInsertModels, new()); } - + [Benchmark] public void SmallDocClientBulkWriteInsertBenchmark() { diff --git a/src/MongoDB.Bson/Exceptions/DuplicateBsonMemberMapAttributeException.cs b/src/MongoDB.Bson/Exceptions/DuplicateBsonMemberMapAttributeException.cs index caefa7ec10f..07fd875534f 100644 --- a/src/MongoDB.Bson/Exceptions/DuplicateBsonMemberMapAttributeException.cs +++ b/src/MongoDB.Bson/Exceptions/DuplicateBsonMemberMapAttributeException.cs @@ -23,7 +23,7 @@ namespace MongoDB.Bson /// public class DuplicateBsonMemberMapAttributeException : BsonException { - // constructors + // constructors /// /// Initializes a new instance of the class. /// diff --git a/src/MongoDB.Bson/IO/BsonBinaryReaderSettings.cs b/src/MongoDB.Bson/IO/BsonBinaryReaderSettings.cs index 72305ed0169..1c510ed71e3 100644 --- a/src/MongoDB.Bson/IO/BsonBinaryReaderSettings.cs +++ b/src/MongoDB.Bson/IO/BsonBinaryReaderSettings.cs @@ -76,7 +76,7 @@ public UTF8Encoding Encoding } /// - /// Gets or sets whether to fix occurrences of the old binary subtype on input. + /// Gets or sets whether to fix occurrences of the old binary subtype on input. /// public bool FixOldBinarySubTypeOnInput { @@ -89,7 +89,7 @@ public bool FixOldBinarySubTypeOnInput } /// - /// Gets or sets whether to fix occurrences of the old representation of DateTime.MaxValue on input. + /// Gets or sets whether to fix occurrences of the old representation of DateTime.MaxValue on input. /// public bool FixOldDateTimeMaxValueOnInput { diff --git a/src/MongoDB.Bson/IO/ByteBufferStream.cs b/src/MongoDB.Bson/IO/ByteBufferStream.cs index eddc84df2bf..6c04117dded 100644 --- a/src/MongoDB.Bson/IO/ByteBufferStream.cs +++ b/src/MongoDB.Bson/IO/ByteBufferStream.cs @@ -572,7 +572,7 @@ public override void WriteCString(string value) { // Compare to 128 to preserve original behavior const int maxLengthToUseCStringUtf8EncodingWith = 128; - + if (maxLength <= maxLengthToUseCStringUtf8EncodingWith) { using var rentedBuffer = ThreadStaticBuffer.RentBuffer(maxLengthToUseCStringUtf8EncodingWith); diff --git a/src/MongoDB.Bson/IO/InputBufferChunkSource.cs b/src/MongoDB.Bson/IO/InputBufferChunkSource.cs index 6997de9d818..470a4910fcb 100644 --- a/src/MongoDB.Bson/IO/InputBufferChunkSource.cs +++ b/src/MongoDB.Bson/IO/InputBufferChunkSource.cs @@ -132,7 +132,7 @@ public int MaxUnpooledChunkSize get { return _maxUnpooledChunkSize; } } - // methods + // methods /// public void Dispose() { diff --git a/src/MongoDB.Bson/ObjectModel/MaterializedOnDemandBsonDocument.cs b/src/MongoDB.Bson/ObjectModel/MaterializedOnDemandBsonDocument.cs index 1c2bbcfc5ef..70ea8d12601 100644 --- a/src/MongoDB.Bson/ObjectModel/MaterializedOnDemandBsonDocument.cs +++ b/src/MongoDB.Bson/ObjectModel/MaterializedOnDemandBsonDocument.cs @@ -407,7 +407,7 @@ public override IEnumerator GetEnumerator() /// Returns a hash code for this instance. /// /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// public override int GetHashCode() { diff --git a/src/MongoDB.Bson/Serialization/BinaryVectorReader.cs b/src/MongoDB.Bson/Serialization/BinaryVectorReader.cs index 3b751f3c9d6..9c6a0dfe745 100644 --- a/src/MongoDB.Bson/Serialization/BinaryVectorReader.cs +++ b/src/MongoDB.Bson/Serialization/BinaryVectorReader.cs @@ -111,7 +111,7 @@ TExpectedItem[] AsTypedArrayOrThrow() return result; } } - + private static float[] ReadSinglesArrayLittleEndian(ReadOnlySpan span) { if ((span.Length & 3) != 0) diff --git a/src/MongoDB.Bson/Serialization/BinaryVectorWriter.cs b/src/MongoDB.Bson/Serialization/BinaryVectorWriter.cs index 9f1ba73b075..03cd5be9fdd 100644 --- a/src/MongoDB.Bson/Serialization/BinaryVectorWriter.cs +++ b/src/MongoDB.Bson/Serialization/BinaryVectorWriter.cs @@ -39,7 +39,7 @@ public static byte[] WriteToBytes(ReadOnlySpan vectorData, BinaryV switch (binaryVectorDataType) { case BinaryVectorDataType.Float32: - var length = vectorData.Length * 4; + var length = vectorData.Length * 4; var result = new byte[2 + length]; result[0] = (byte)binaryVectorDataType; result[1] = padding; diff --git a/src/MongoDB.Bson/Serialization/BsonSerializationContext.cs b/src/MongoDB.Bson/Serialization/BsonSerializationContext.cs index 5ab93777ceb..a14a62322a8 100644 --- a/src/MongoDB.Bson/Serialization/BsonSerializationContext.cs +++ b/src/MongoDB.Bson/Serialization/BsonSerializationContext.cs @@ -38,7 +38,7 @@ private BsonSerializationContext( // public properties /// - /// Gets a function that, when executed, will indicate whether the type + /// Gets a function that, when executed, will indicate whether the type /// is a dynamic type. /// public Func IsDynamicType diff --git a/src/MongoDB.Bson/Serialization/Conventions/ConventionRegistry.cs b/src/MongoDB.Bson/Serialization/Conventions/ConventionRegistry.cs index f54934d6ed3..217a7b69d86 100644 --- a/src/MongoDB.Bson/Serialization/Conventions/ConventionRegistry.cs +++ b/src/MongoDB.Bson/Serialization/Conventions/ConventionRegistry.cs @@ -116,8 +116,8 @@ public static void Register(string name, IConventionPack conventions, Func /// The name. - /// Removing a convention allows the removal of the special __defaults__ conventions - /// and the __attributes__ conventions for those who want to completely customize the + /// Removing a convention allows the removal of the special __defaults__ conventions + /// and the __attributes__ conventions for those who want to completely customize the /// experience. public static void Remove(string name) { diff --git a/src/MongoDB.Bson/Serialization/Conventions/ImmutableTypeClassMapConvention.cs b/src/MongoDB.Bson/Serialization/Conventions/ImmutableTypeClassMapConvention.cs index bb50574b190..717cd61b3fd 100644 --- a/src/MongoDB.Bson/Serialization/Conventions/ImmutableTypeClassMapConvention.cs +++ b/src/MongoDB.Bson/Serialization/Conventions/ImmutableTypeClassMapConvention.cs @@ -130,7 +130,7 @@ private bool PropertyMatchesSomeCreatorParameter(BsonClassMap classMap, Property var constructors = GetUsableConstructors(classTypeInfo); foreach (var constructorInfo in constructors) { - if (classTypeInfo.IsAbstract || + if (classTypeInfo.IsAbstract || constructorInfo.IsFamily || // protected constructorInfo.IsFamilyOrAssembly) // protected internal { diff --git a/src/MongoDB.Bson/Serialization/IdGenerators/AscendingGuidGenerator.cs b/src/MongoDB.Bson/Serialization/IdGenerators/AscendingGuidGenerator.cs index cbf696ea98e..f9cf72d396d 100644 --- a/src/MongoDB.Bson/Serialization/IdGenerators/AscendingGuidGenerator.cs +++ b/src/MongoDB.Bson/Serialization/IdGenerators/AscendingGuidGenerator.cs @@ -20,7 +20,7 @@ namespace MongoDB.Bson.Serialization.IdGenerators { /// - /// A GUID generator that generates GUIDs in ascending order. To enable + /// A GUID generator that generates GUIDs in ascending order. To enable /// an index to make use of the ascending nature make sure to use /// GuidRepresentation.Standard /// as the storage representation. @@ -62,7 +62,7 @@ public static AscendingGuidGenerator Instance /// Generates an ascending Guid for a document. Consecutive invocations /// should generate Guids that are ascending from a MongoDB perspective /// - /// The container of the document (will be a + /// The container of the document (will be a /// MongoCollection when called from the driver). /// The document it was generated for. /// A Guid. diff --git a/src/MongoDB.Bson/Serialization/Serializers/ExpandoObjectSerializer.cs b/src/MongoDB.Bson/Serialization/Serializers/ExpandoObjectSerializer.cs index 7160bc11288..4ac504304e5 100644 --- a/src/MongoDB.Bson/Serialization/Serializers/ExpandoObjectSerializer.cs +++ b/src/MongoDB.Bson/Serialization/Serializers/ExpandoObjectSerializer.cs @@ -22,7 +22,7 @@ namespace MongoDB.Bson.Serialization.Serializers /// Serializer for . /// /// - /// The use of will serialize any without type information. + /// The use of will serialize any without type information. /// To get the best experience out of using an , any member wanting to be used /// as an array should use . /// diff --git a/src/MongoDB.Bson/Serialization/Serializers/IEnumerableDeserializingAsCollectionSerializer.cs b/src/MongoDB.Bson/Serialization/Serializers/IEnumerableDeserializingAsCollectionSerializer.cs index a5ce3afa28d..ca9ec6a771b 100644 --- a/src/MongoDB.Bson/Serialization/Serializers/IEnumerableDeserializingAsCollectionSerializer.cs +++ b/src/MongoDB.Bson/Serialization/Serializers/IEnumerableDeserializingAsCollectionSerializer.cs @@ -179,7 +179,7 @@ public IEnumerableDeserializingAsCollectionSerializer ItemSerializer; + IBsonSerializer IChildSerializerConfigurable.ChildSerializer => ItemSerializer; IBsonSerializer IChildSerializerConfigurable.WithChildSerializer(IBsonSerializer childSerializer) => WithItemSerializer((IBsonSerializer)childSerializer); diff --git a/src/MongoDB.Driver/Authentication/Gssapi/Sspi/EncryptQualityOfProtection.cs b/src/MongoDB.Driver/Authentication/Gssapi/Sspi/EncryptQualityOfProtection.cs index 53a1f826180..135b039cc85 100644 --- a/src/MongoDB.Driver/Authentication/Gssapi/Sspi/EncryptQualityOfProtection.cs +++ b/src/MongoDB.Driver/Authentication/Gssapi/Sspi/EncryptQualityOfProtection.cs @@ -19,7 +19,7 @@ namespace MongoDB.Driver.Authentication.Gssapi.Sspi /// Flags for EncryptMessage. /// /// - /// See the fQOP parameter at + /// See the fQOP parameter at /// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375378(v=vs.85).aspx. /// internal enum EncryptQualityOfProtection : uint diff --git a/src/MongoDB.Driver/Authentication/SaslMapParser.cs b/src/MongoDB.Driver/Authentication/SaslMapParser.cs index f4050696fec..dcc5b5480d9 100644 --- a/src/MongoDB.Driver/Authentication/SaslMapParser.cs +++ b/src/MongoDB.Driver/Authentication/SaslMapParser.cs @@ -24,7 +24,7 @@ namespace MongoDB.Driver.Authentication /// "SCRAM is a SASL mechanism whose client response and server challenge /// messages are text-based messages containing one or more attribute- /// value pairs separated by commas. Each attribute has a one-letter - /// name." + /// name." /// internal static class SaslMapParser { diff --git a/src/MongoDB.Driver/Authentication/SaslPrepHelper.cs b/src/MongoDB.Driver/Authentication/SaslPrepHelper.cs index ae9793f6859..dc14a565a45 100644 --- a/src/MongoDB.Driver/Authentication/SaslPrepHelper.cs +++ b/src/MongoDB.Driver/Authentication/SaslPrepHelper.cs @@ -141,7 +141,7 @@ private static string SaslPrep(string str, bool allowUnassigned) /// /// Return true if the given is an ASCII control character as defined by - /// RFC 3454, Appendix C.2.1. + /// RFC 3454, Appendix C.2.1. /// /// The character. /// Whether the given character is an ASCII control character. @@ -187,7 +187,7 @@ private static int CharCount(int codepoint) /// /// Return true if the given is inappropriate for canonical representation - /// characters as defined by RFC 3454, Appendix C.7. + /// characters as defined by RFC 3454, Appendix C.7. /// /// The Unicode character's codepoint. /// True if the codepoint is inappropriate for canonical. @@ -647,7 +647,7 @@ private static bool IsSurrogateCodepoint(int codepoint) /// /// Return true if the given is a "commonly mapped to nothing" character as defined by - /// RFC 3454, Appendix B.1. + /// RFC 3454, Appendix B.1. /// /// The character. /// Whether the given character is a "commonly mapped to nothing" character. @@ -669,7 +669,7 @@ private static bool MappedToNothing(char ch) /// /// Return true if the given is a non-ASCII control character as defined by - /// RFC 3454, Appendix C.2.2. + /// RFC 3454, Appendix C.2.2. /// /// The Unicode character's codepoint. /// Whether the given character is a non-ASCII control character. @@ -695,7 +695,7 @@ private static bool NonAsciiControl(int codepoint) /// /// Return true if the given is a non-ASCII space character as defined by - /// RFC 3454, Appendix C.1.2. + /// RFC 3454, Appendix C.1.2. /// /// The character. /// Whether the given character is a non-ASCII space character. @@ -752,7 +752,7 @@ private static bool PrivateUse(int codepoint) /// /// Return true if the given is a prohibited character as defined by - ///RFC 4013, Section 2.3. + ///RFC 4013, Section 2.3. /// /// The Unicode character's codepoint. /// Whether the codepoint is a prohibited character. diff --git a/src/MongoDB.Driver/Core/Bindings/CoreSession.cs b/src/MongoDB.Driver/Core/Bindings/CoreSession.cs index 66fa294a14f..76a8c54ede4 100644 --- a/src/MongoDB.Driver/Core/Bindings/CoreSession.cs +++ b/src/MongoDB.Driver/Core/Bindings/CoreSession.cs @@ -404,7 +404,7 @@ public void StartTransaction(TransactionOptions transactionOptions = null) throw new InvalidOperationException("Transactions do not support unacknowledged write concerns."); } - _currentTransaction?.UnpinAll(); // unpin data if any when a new transaction is started + _currentTransaction?.UnpinAll(); // unpin data if any when a new transaction is started _currentTransaction = new CoreTransaction(transactionNumber, effectiveTransactionOptions); } diff --git a/src/MongoDB.Driver/Core/Clusters/ClusterClock.cs b/src/MongoDB.Driver/Core/Clusters/ClusterClock.cs index 7cc7c164435..b816cf7a10f 100644 --- a/src/MongoDB.Driver/Core/Clusters/ClusterClock.cs +++ b/src/MongoDB.Driver/Core/Clusters/ClusterClock.cs @@ -52,7 +52,7 @@ public void AdvanceClusterTime(BsonDocument newClusterTime) _clusterTime = GreaterClusterTime(_clusterTime, newClusterTime); } } - + internal sealed class NoClusterClock : IClusterClock { public BsonDocument ClusterTime => null; diff --git a/src/MongoDB.Driver/Core/Clusters/ElectionId.cs b/src/MongoDB.Driver/Core/Clusters/ElectionId.cs index 20d0d4aa77c..63ee73465c9 100644 --- a/src/MongoDB.Driver/Core/Clusters/ElectionId.cs +++ b/src/MongoDB.Driver/Core/Clusters/ElectionId.cs @@ -79,7 +79,7 @@ public bool Equals(ElectionId other) /// Returns a hash code for this instance. /// /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// public override int GetHashCode() { diff --git a/src/MongoDB.Driver/Core/Clusters/IClusterClock.cs b/src/MongoDB.Driver/Core/Clusters/IClusterClock.cs index 0e3dabc5593..9e11dc88859 100644 --- a/src/MongoDB.Driver/Core/Clusters/IClusterClock.cs +++ b/src/MongoDB.Driver/Core/Clusters/IClusterClock.cs @@ -20,7 +20,7 @@ namespace MongoDB.Driver.Core.Clusters internal interface IClusterClock { BsonDocument ClusterTime { get; } - + void AdvanceClusterTime(BsonDocument newClusterTime); } } diff --git a/src/MongoDB.Driver/Core/Compression/ICompressor.cs b/src/MongoDB.Driver/Core/Compression/ICompressor.cs index 4d7a74cc0c0..5db2c91b724 100644 --- a/src/MongoDB.Driver/Core/Compression/ICompressor.cs +++ b/src/MongoDB.Driver/Core/Compression/ICompressor.cs @@ -33,11 +33,11 @@ public enum CompressorType /// Snappy = 1, /// - /// The content of the message is compressed using zlib. + /// The content of the message is compressed using zlib. /// Zlib = 2, /// - /// The content of the message is compressed using zstandard. + /// The content of the message is compressed using zstandard. /// ZStandard = 3 } diff --git a/src/MongoDB.Driver/Core/Compression/ZlibCompressor.cs b/src/MongoDB.Driver/Core/Compression/ZlibCompressor.cs index 21ad94542a0..9e7b7e8ad88 100644 --- a/src/MongoDB.Driver/Core/Compression/ZlibCompressor.cs +++ b/src/MongoDB.Driver/Core/Compression/ZlibCompressor.cs @@ -24,7 +24,7 @@ namespace MongoDB.Driver.Core.Compression { /// /// Compressor according to the zlib algorithm. - /// + /// internal sealed class ZlibCompressor : ICompressor { private readonly CompressionLevel _compressionLevel; diff --git a/src/MongoDB.Driver/Core/Events/Diagnostics/PerformanceCounterEventSubscriber.cs b/src/MongoDB.Driver/Core/Events/Diagnostics/PerformanceCounterEventSubscriber.cs index c7f92351285..48c2e474096 100644 --- a/src/MongoDB.Driver/Core/Events/Diagnostics/PerformanceCounterEventSubscriber.cs +++ b/src/MongoDB.Driver/Core/Events/Diagnostics/PerformanceCounterEventSubscriber.cs @@ -32,7 +32,7 @@ namespace MongoDB.Driver.Core.Events.Diagnostics /// public sealed class PerformanceCounterEventSubscriber : IEventSubscriber { - //static + //static /// /// Installs the performance counters. /// diff --git a/src/MongoDB.Driver/Core/Events/ReflectionEventSubscriber.cs b/src/MongoDB.Driver/Core/Events/ReflectionEventSubscriber.cs index cb6ed20bd2d..638b3d1e898 100644 --- a/src/MongoDB.Driver/Core/Events/ReflectionEventSubscriber.cs +++ b/src/MongoDB.Driver/Core/Events/ReflectionEventSubscriber.cs @@ -22,7 +22,7 @@ namespace MongoDB.Driver.Core.Events { /// - /// Subscribes methods with a single argument to events + /// Subscribes methods with a single argument to events /// of that single argument's type. /// public sealed class ReflectionEventSubscriber : IEventSubscriber diff --git a/src/MongoDB.Driver/Core/Logging/StructuredLogTemplateProvidersSdam.cs b/src/MongoDB.Driver/Core/Logging/StructuredLogTemplateProvidersSdam.cs index 5447eded8e7..63a63025d7b 100644 --- a/src/MongoDB.Driver/Core/Logging/StructuredLogTemplateProvidersSdam.cs +++ b/src/MongoDB.Driver/Core/Logging/StructuredLogTemplateProvidersSdam.cs @@ -78,6 +78,6 @@ private static void AddSdamTemplates() LogLevel.Trace, CmapCommonParams(Description), (e, _) => GetParams(e.ServerId, "Server description changed", e.NewDescription)); - } + } } } diff --git a/src/MongoDB.Driver/Core/Misc/BatchableSource.cs b/src/MongoDB.Driver/Core/Misc/BatchableSource.cs index f987aa1dc90..4452dac3a99 100644 --- a/src/MongoDB.Driver/Core/Misc/BatchableSource.cs +++ b/src/MongoDB.Driver/Core/Misc/BatchableSource.cs @@ -50,7 +50,7 @@ private static IReadOnlyList EnumeratorToList(IEnumerator enumerator) /// Initializes a new instance of the class. /// /// - /// Use this overload when you know the batch is small and won't have to be broken up into sub-batches. + /// Use this overload when you know the batch is small and won't have to be broken up into sub-batches. /// In that case using this overload is simpler than using an enumerator and using the other constructor. /// /// The single batch. diff --git a/src/MongoDB.Driver/Core/Misc/SemaphoreSlimRequest.cs b/src/MongoDB.Driver/Core/Misc/SemaphoreSlimRequest.cs index eed0ee4a21e..70e6895661d 100644 --- a/src/MongoDB.Driver/Core/Misc/SemaphoreSlimRequest.cs +++ b/src/MongoDB.Driver/Core/Misc/SemaphoreSlimRequest.cs @@ -56,7 +56,7 @@ public SemaphoreSlimRequest(SemaphoreSlim semaphore, CancellationToken cancellat /// public Task Task => _task; - // public methods + // public methods /// public void Dispose() { diff --git a/src/MongoDB.Driver/Core/Operations/FindAndModifyOperationBase.cs b/src/MongoDB.Driver/Core/Operations/FindAndModifyOperationBase.cs index 8bad1138f40..a09b9e1219b 100644 --- a/src/MongoDB.Driver/Core/Operations/FindAndModifyOperationBase.cs +++ b/src/MongoDB.Driver/Core/Operations/FindAndModifyOperationBase.cs @@ -104,7 +104,7 @@ public TResult Execute(RetryableWriteContext context, CancellationToken cancella public Task ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken) { using (BeginOperation()) - { + { return RetryableWriteOperationExecutor.ExecuteAsync(this, binding, _retryRequested, cancellationToken); } } @@ -147,12 +147,12 @@ public async Task ExecuteAttemptAsync(RetryableWriteContext context, in return ProcessCommandResult(channel.ConnectionDescription.ConnectionId, rawBsonDocument); } } - } - + } + public abstract BsonDocument CreateCommand(ICoreSessionHandle session, ConnectionDescription connectionDescription, long? transactionNumber); - protected abstract IElementNameValidator GetCommandValidator(); - + protected abstract IElementNameValidator GetCommandValidator(); + private IDisposable BeginOperation() => EventContext.BeginOperation("findAndModify"); private WriteCommandOperation CreateOperation(ICoreSessionHandle session, ConnectionDescription connectionDescription, long? transactionNumber) diff --git a/src/MongoDB.Driver/Core/ReadConcernLevel.cs b/src/MongoDB.Driver/Core/ReadConcernLevel.cs index 699ea4511de..b8ff17e2e75 100644 --- a/src/MongoDB.Driver/Core/ReadConcernLevel.cs +++ b/src/MongoDB.Driver/Core/ReadConcernLevel.cs @@ -36,10 +36,10 @@ public enum ReadConcernLevel Majority, /// - /// Avoids returning data from a "stale" primary - /// (one that has already been superseded by a new primary but doesn't know it yet). - /// It is important to note that readConcern level linearizable does not by itself - /// produce linearizable reads; they must be issued in conjunction with w:majority + /// Avoids returning data from a "stale" primary + /// (one that has already been superseded by a new primary but doesn't know it yet). + /// It is important to note that readConcern level linearizable does not by itself + /// produce linearizable reads; they must be issued in conjunction with w:majority /// writes to the same document(s) in order to be linearizable. /// Linearizable, diff --git a/src/MongoDB.Driver/ExternalEvidence.cs b/src/MongoDB.Driver/ExternalEvidence.cs index ce1b0c9aeef..ab714bcfe14 100644 --- a/src/MongoDB.Driver/ExternalEvidence.cs +++ b/src/MongoDB.Driver/ExternalEvidence.cs @@ -21,7 +21,7 @@ namespace MongoDB.Driver { /// - /// Evidence of a MongoIdentity via an external mechanism. For example, on windows this may + /// Evidence of a MongoIdentity via an external mechanism. For example, on windows this may /// be the current process' user or, on linux, via kinit. /// public sealed class ExternalEvidence : MongoIdentityEvidence @@ -48,7 +48,7 @@ public override bool Equals(object obj) /// Returns a hash code for this instance. /// /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// public override int GetHashCode() { diff --git a/src/MongoDB.Driver/GeoJsonObjectModel/GeoJsonCoordinates.cs b/src/MongoDB.Driver/GeoJsonObjectModel/GeoJsonCoordinates.cs index b20ebe7e4a2..41c42424e23 100644 --- a/src/MongoDB.Driver/GeoJsonObjectModel/GeoJsonCoordinates.cs +++ b/src/MongoDB.Driver/GeoJsonObjectModel/GeoJsonCoordinates.cs @@ -92,7 +92,7 @@ public override bool Equals(object obj) /// Returns a hash code for this instance. /// /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// public override int GetHashCode() { diff --git a/src/MongoDB.Driver/IMongoIndexManager.cs b/src/MongoDB.Driver/IMongoIndexManager.cs index 08e1c04e2a1..3321723f226 100644 --- a/src/MongoDB.Driver/IMongoIndexManager.cs +++ b/src/MongoDB.Driver/IMongoIndexManager.cs @@ -166,7 +166,7 @@ string CreateOne( /// /// Creates an index. /// - /// The keys. + /// The keys. /// The create index request options. /// The cancellation token. /// diff --git a/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Expressions/AstRangeExpression.cs b/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Expressions/AstRangeExpression.cs index 9102691dc0b..cb6f8c97103 100644 --- a/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Expressions/AstRangeExpression.cs +++ b/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Expressions/AstRangeExpression.cs @@ -52,7 +52,7 @@ public override BsonValue Render() { args.Add(_step.Render()); } - + return new BsonDocument("$range", args); } diff --git a/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstMergeStage.cs b/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstMergeStage.cs index b3e4e016885..7894d87af11 100644 --- a/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstMergeStage.cs +++ b/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstMergeStage.cs @@ -105,7 +105,7 @@ public AstMergeStage Update(IEnumerable let) private BsonValue RenderInto() { - return + return _intoDatabase == null ? _intoCollection : new BsonDocument { { "db", _intoDatabase }, { "coll", _intoCollection } }; diff --git a/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstReplaceRootStage.cs b/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstReplaceRootStage.cs index 2241de2a97f..7a0dbc3d892 100644 --- a/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstReplaceRootStage.cs +++ b/src/MongoDB.Driver/Linq/Linq3Implementation/Ast/Stages/AstReplaceRootStage.cs @@ -25,7 +25,7 @@ internal sealed class AstReplaceRootStage : AstStage private readonly AstExpression _expression; public AstReplaceRootStage(AstExpression expression) - { + { _expression = Ensure.IsNotNull(expression, nameof(expression)); } diff --git a/src/MongoDB.Driver/Linq/Linq3Implementation/Serializers/EnumUnderlyingTypeSerializer.cs b/src/MongoDB.Driver/Linq/Linq3Implementation/Serializers/EnumUnderlyingTypeSerializer.cs index 577ddef0c82..816e5fc237f 100644 --- a/src/MongoDB.Driver/Linq/Linq3Implementation/Serializers/EnumUnderlyingTypeSerializer.cs +++ b/src/MongoDB.Driver/Linq/Linq3Implementation/Serializers/EnumUnderlyingTypeSerializer.cs @@ -25,11 +25,11 @@ internal interface IEnumUnderlyingTypeSerializer IBsonSerializer EnumSerializer { get; } } - internal class EnumUnderlyingTypeSerializer : StructSerializerBase, IEnumUnderlyingTypeSerializer - where TEnum : Enum + internal class EnumUnderlyingTypeSerializer : StructSerializerBase, IEnumUnderlyingTypeSerializer + where TEnum : Enum where TEnumUnderlyingType : struct { - // private fields + // private fields private readonly IBsonSerializer _enumSerializer; // constructors diff --git a/src/MongoDB.Driver/MongoIdentityEvidence.cs b/src/MongoDB.Driver/MongoIdentityEvidence.cs index 17456390644..e987ac5ec7e 100644 --- a/src/MongoDB.Driver/MongoIdentityEvidence.cs +++ b/src/MongoDB.Driver/MongoIdentityEvidence.cs @@ -69,7 +69,7 @@ internal MongoIdentityEvidence() /// Returns a hash code for this instance. /// /// - /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. + /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// public abstract override int GetHashCode(); } diff --git a/src/MongoDB.Driver/Search/SearchAutocompleteTokenOrder.cs b/src/MongoDB.Driver/Search/SearchAutocompleteTokenOrder.cs index 780698e2d93..fbe8745c51c 100644 --- a/src/MongoDB.Driver/Search/SearchAutocompleteTokenOrder.cs +++ b/src/MongoDB.Driver/Search/SearchAutocompleteTokenOrder.cs @@ -24,7 +24,7 @@ public enum SearchAutocompleteTokenOrder /// Indicates that tokens in the query can appear in any order in the documents. /// Any, - + /// /// Indicates that tokens in the query must appear adjacent to each other or in the order /// specified in the query in the documents. diff --git a/src/MongoDB.Driver/Search/SearchDefinitionBuilder.cs b/src/MongoDB.Driver/Search/SearchDefinitionBuilder.cs index 21f51069093..2f813f65211 100644 --- a/src/MongoDB.Driver/Search/SearchDefinitionBuilder.cs +++ b/src/MongoDB.Driver/Search/SearchDefinitionBuilder.cs @@ -139,7 +139,7 @@ public SearchDefinition Equals( TField value, SearchScoreDefinition score = null) => Equals(new ExpressionFieldDefinition(path), value, score); - + /// /// Creates a search definition that queries for documents where at least one element in an indexed array field is equal /// to the specified value. @@ -340,7 +340,7 @@ public SearchDefinition In( IEnumerable values, SearchScoreDefinition score = null) => In(new ExpressionFieldDefinition(path), values, score); - + /// /// Creates a search definition that queries for documents where the value of the field equals to any of specified values. /// @@ -639,7 +639,7 @@ public SearchDefinition Range( SearchScoreDefinition score = null) where TField : struct, IComparable => Range(new ExpressionFieldDefinition(path), range, score); - + /// /// Creates a search definition that queries for documents where a field is in the specified range. /// @@ -672,9 +672,9 @@ public SearchDefinition Range( path, new SearchRangeV2( range.Min.HasValue ? new(range.Min.Value, range.IsMinInclusive) : null, - range.Max.HasValue ? new(range.Max.Value, range.IsMaxInclusive) : null), + range.Max.HasValue ? new(range.Max.Value, range.IsMaxInclusive) : null), score); - + /// /// Creates a search definition that queries for documents where a field is in the specified range. /// @@ -688,7 +688,7 @@ public SearchDefinition Range( SearchRangeV2 range, SearchScoreDefinition score = null) => Range(new ExpressionFieldDefinition(path), range, score); - + /// /// Creates a search definition that queries for documents where a field is in the specified range. /// @@ -702,7 +702,7 @@ public SearchDefinition Range( SearchRangeV2 range, SearchScoreDefinition score = null) => Range(new ExpressionFieldDefinition(path), range, score); - + /// /// Creates a search definition that queries for documents where a field is in the specified range. /// diff --git a/src/MongoDB.Driver/Search/SearchPathDefinition.cs b/src/MongoDB.Driver/Search/SearchPathDefinition.cs index 7ef9058f6ef..1faa079d5d0 100644 --- a/src/MongoDB.Driver/Search/SearchPathDefinition.cs +++ b/src/MongoDB.Driver/Search/SearchPathDefinition.cs @@ -77,7 +77,7 @@ public static implicit operator SearchPathDefinition(List(fields); /// - /// Performs an implicit conversion from an array of field names to + /// Performs an implicit conversion from an array of field names to /// . /// /// The array of field names. @@ -88,7 +88,7 @@ public static implicit operator SearchPathDefinition(string[] fieldNa new MultiSearchPathDefinition(fieldNames.Select(fieldName => new StringFieldDefinition(fieldName))); /// - /// Performs an implicit conversion from an array of field names to + /// Performs an implicit conversion from an array of field names to /// . /// /// The list of field names. diff --git a/src/MongoDB.Driver/Search/SearchRangeV2.cs b/src/MongoDB.Driver/Search/SearchRangeV2.cs index ceb0cd14ef7..005f896de4f 100644 --- a/src/MongoDB.Driver/Search/SearchRangeV2.cs +++ b/src/MongoDB.Driver/Search/SearchRangeV2.cs @@ -16,7 +16,7 @@ namespace MongoDB.Driver.Search { /// - /// Object that specifies the boundaries for a range query. + /// Object that specifies the boundaries for a range query. /// /// The type of the range value. public struct SearchRangeV2 @@ -43,7 +43,7 @@ public SearchRangeV2(Bound min, Bound max) /// Gets the lower bound of the range. public Bound Min { get; } } - + /// /// Represents a bound value. /// @@ -54,7 +54,7 @@ public sealed class Bound /// Gets the bound value. /// public TValue Value { get; } - + /// /// Gets whether the bound is inclusive or not. /// @@ -71,7 +71,7 @@ public Bound(TValue value, bool inclusive = false) Inclusive = inclusive; } } - + /// /// A builder for a SearchRangeV2. /// diff --git a/src/MongoDB.Driver/WriteModel.cs b/src/MongoDB.Driver/WriteModel.cs index c517899d304..ea1ed187205 100644 --- a/src/MongoDB.Driver/WriteModel.cs +++ b/src/MongoDB.Driver/WriteModel.cs @@ -32,7 +32,7 @@ public abstract class WriteModel // API, so there is type safety in how they got allowed // into the system, meaning that even though // some things below seem unsafe, they are in a roundabout - // way. In addition, we know that there will always + // way. In addition, we know that there will always // be one level of BsonDocumentWrapper for everything, even // when the type is already a BsonDocument :(. diff --git a/src/MongoDB.Shared/Hasher.cs b/src/MongoDB.Shared/Hasher.cs index 580a0621d28..7543095d80f 100644 --- a/src/MongoDB.Shared/Hasher.cs +++ b/src/MongoDB.Shared/Hasher.cs @@ -21,7 +21,7 @@ namespace MongoDB.Shared { internal class Hasher { - #region static + #region static // public static methods [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/tests/MongoDB.Bson.TestHelpers/Threading/ThreadPerTaskScheduler.cs b/tests/MongoDB.Bson.TestHelpers/Threading/ThreadPerTaskScheduler.cs index 001c0fe3a67..707122c0785 100644 --- a/tests/MongoDB.Bson.TestHelpers/Threading/ThreadPerTaskScheduler.cs +++ b/tests/MongoDB.Bson.TestHelpers/Threading/ThreadPerTaskScheduler.cs @@ -23,21 +23,21 @@ namespace MongoDB.Bson.TestHelpers // https://github.com/dotnet/samples/blob/main/csharp/parallel/ParallelExtensionsExtras/TaskSchedulers/ThreadPerTaskkScheduler.cs public sealed class ThreadPerTaskScheduler : TaskScheduler { - /// Gets the tasks currently scheduled to this scheduler. - /// This will always return an empty enumerable, as tasks are launched as soon as they're queued. + /// Gets the tasks currently scheduled to this scheduler. + /// This will always return an empty enumerable, as tasks are launched as soon as they're queued. protected override IEnumerable GetScheduledTasks() { return Enumerable.Empty(); } - /// Starts a new thread to process the provided task. - /// The task to be executed. + /// Starts a new thread to process the provided task. + /// The task to be executed. protected override void QueueTask(Task task) { new Thread(() => TryExecuteTask(task)) { IsBackground = true }.Start(); } - /// Runs the provided task on the current thread. - /// The task to be executed. - /// Ignored. - /// Whether the task could be executed on the current thread. + /// Runs the provided task on the current thread. + /// The task to be executed. + /// Ignored. + /// Whether the task could be executed on the current thread. protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) { return TryExecuteTask(task); diff --git a/tests/MongoDB.Bson.Tests/Serialization/BsonSerializerTests.cs b/tests/MongoDB.Bson.Tests/Serialization/BsonSerializerTests.cs index 4be63a8fffc..fdb58fcba24 100644 --- a/tests/MongoDB.Bson.Tests/Serialization/BsonSerializerTests.cs +++ b/tests/MongoDB.Bson.Tests/Serialization/BsonSerializerTests.cs @@ -135,7 +135,7 @@ public void TestSerializeOrder() Assert.True(bson.SequenceEqual(rehydrated.ToBson())); } - public class InventoryItem + public class InventoryItem : ISupportInitialize { public int Price { get; set; } diff --git a/tests/MongoDB.Bson.Tests/Serialization/Serializers/BinaryVectorSerializerTests.cs b/tests/MongoDB.Bson.Tests/Serialization/Serializers/BinaryVectorSerializerTests.cs index 274e93de373..0335d4efa50 100644 --- a/tests/MongoDB.Bson.Tests/Serialization/Serializers/BinaryVectorSerializerTests.cs +++ b/tests/MongoDB.Bson.Tests/Serialization/Serializers/BinaryVectorSerializerTests.cs @@ -372,7 +372,7 @@ private static (T[], byte[] VectorBson) GetTestData(BinaryVectorDataType data var elementsBytesLittleEndian = BitConverter.IsLittleEndian ? MemoryMarshal.Cast(elementsSpan) : BigEndianToLittleEndian(elementsSpan, dataType); - + byte[] vectorBsonData = [(byte)dataType, bitsPadding, .. elementsBytesLittleEndian]; return (elementsSpan.ToArray(), vectorBsonData); } @@ -439,7 +439,7 @@ private static byte[] BigEndianToLittleEndian(ReadOnlySpan span, BinaryVec public class BinaryVectorNoAttributeHolder { public BinaryVectorInt8 ValuesInt8 { get; set; } - + public BinaryVectorPackedBit ValuesPackedBit { get; set; } public BinaryVectorFloat32 ValuesFloat { get; set; } diff --git a/tests/MongoDB.Bson.Tests/Serialization/Serializers/ReadOnlyDictionarySerializerTests.cs b/tests/MongoDB.Bson.Tests/Serialization/Serializers/ReadOnlyDictionarySerializerTests.cs index 1a8d840ddde..5c4dadfd29a 100644 --- a/tests/MongoDB.Bson.Tests/Serialization/Serializers/ReadOnlyDictionarySerializerTests.cs +++ b/tests/MongoDB.Bson.Tests/Serialization/Serializers/ReadOnlyDictionarySerializerTests.cs @@ -185,7 +185,7 @@ public void TestNominalTypeReadOnlyDictionarySubclassActualTypeReadOnlyDictionar Assert.True(bson.SequenceEqual(rehydrated.ToBson())); } - // Tests where nominal type is a class that implements IReadOnlyDictionary + // Tests where nominal type is a class that implements IReadOnlyDictionary [Fact] public void TestNominalTypeCustomIReadOnlyDictionaryActualTypeCustomIReadOnlyDictionary() diff --git a/tests/MongoDB.Driver.Encryption.Tests/HashCallbackTests.cs b/tests/MongoDB.Driver.Encryption.Tests/HashCallbackTests.cs index 1b011b6f7c1..9c93f14f4c7 100644 --- a/tests/MongoDB.Driver.Encryption.Tests/HashCallbackTests.cs +++ b/tests/MongoDB.Driver.Encryption.Tests/HashCallbackTests.cs @@ -26,7 +26,7 @@ public void HashTest() { var inputHex = "74657374206f66206d6163"; var expectedHex = "9ff3e52fa31c9e0fa0b08e19c40591553ea64b73709633271975bfab2db9d980"; - + var inputBytes = CallbackUtils.GetBytesFromHex(inputHex); var expectedBytes = CallbackUtils.GetBytesFromHex(expectedHex); diff --git a/tests/MongoDB.Driver.Tests/Authentication/SaslPrepHelperTests.cs b/tests/MongoDB.Driver.Tests/Authentication/SaslPrepHelperTests.cs index f0db472ce65..c35b95e153c 100644 --- a/tests/MongoDB.Driver.Tests/Authentication/SaslPrepHelperTests.cs +++ b/tests/MongoDB.Driver.Tests/Authentication/SaslPrepHelperTests.cs @@ -29,9 +29,9 @@ public class SaslPrepHelperTests { [Fact] public void SaslPrepQuery_accepts_undefined_codepoint() - { + { var strWithUnassignedCodepoint = $"abc{char.ConvertFromUtf32(_unassignedCodePoint.Value)}"; - + SaslPrepHelper.SaslPrepQuery(strWithUnassignedCodepoint).Should().Be(strWithUnassignedCodepoint); } @@ -92,7 +92,7 @@ public void SaslPrepStored_returns_expected_output_when_passed_Rfc4013_examples( public void SaslPrep_throws_argument_exception_when_passed_Rfc4013_examples(string expectedError, string input) { var exception = Record.Exception(()=>SaslPrepHelper.SaslPrepStored(input)); - + exception.Should().BeOfType().Subject.Message.Should().Be(expectedError); } @@ -100,18 +100,18 @@ public void SaslPrep_throws_argument_exception_when_passed_Rfc4013_examples(stri public void SaslPrepStored_throws_argument_exception_with_RandALCat_and_LCat_characters() { var exception = Record.Exception(() => SaslPrepHelper.SaslPrepStored("\u0627\u0041\u0627")); - + exception.Should().BeOfType(); exception.Message.Should().Be("Contains both RandALCat characters and LCat characters"); } - + [Fact] public void SaslPrepStored_throws_exception_when_passed_an_undefined_codepoint() - { + { var strWithUnassignedCodepoint = $"abc{char.ConvertFromUtf32(_unassignedCodePoint.Value)}"; - + var exception = Record.Exception(()=>SaslPrepHelper.SaslPrepStored(strWithUnassignedCodepoint)); - + exception.Should().BeOfType(); exception.Message.Should().Be("Character at position 3 is unassigned"); } diff --git a/tests/MongoDB.Driver.Tests/Core/Clusters/DnsMonitorTests.cs b/tests/MongoDB.Driver.Tests/Core/Clusters/DnsMonitorTests.cs index 963131dc2b3..8b270d0b09a 100644 --- a/tests/MongoDB.Driver.Tests/Core/Clusters/DnsMonitorTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/Clusters/DnsMonitorTests.cs @@ -517,7 +517,7 @@ internal static class DnsMonitorReflector public static IDnsMonitoringCluster _cluster(this DnsMonitor obj) => (IDnsMonitoringCluster)Reflector.GetFieldValue(obj, nameof(_cluster)); public static IDnsResolver _dnsResolver(this DnsMonitor obj) => (IDnsResolver)Reflector.GetFieldValue(obj, nameof(_dnsResolver)); public static string _lookupDomainName(this DnsMonitor obj) => (string)Reflector.GetFieldValue(obj, nameof(_lookupDomainName)); - public static bool _processDnsResultHasEverBeenCalled(this DnsMonitor obj) => (bool)Reflector.GetFieldValue(obj, nameof(_processDnsResultHasEverBeenCalled)); + public static bool _processDnsResultHasEverBeenCalled(this DnsMonitor obj) => (bool)Reflector.GetFieldValue(obj, nameof(_processDnsResultHasEverBeenCalled)); public static string _service(this DnsMonitor obj) => (string)Reflector.GetFieldValue(obj, nameof(_service)); public static Exception _unhandledException(this DnsMonitor obj) => (Exception)Reflector.GetFieldValue(obj, nameof(_unhandledException)); diff --git a/tests/MongoDB.Driver.Tests/Core/Configuration/CryptClientSettingsTests.cs b/tests/MongoDB.Driver.Tests/Core/Configuration/CryptClientSettingsTests.cs index ecf4c978841..c7e816fad08 100644 --- a/tests/MongoDB.Driver.Tests/Core/Configuration/CryptClientSettingsTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/Configuration/CryptClientSettingsTests.cs @@ -67,7 +67,7 @@ public void Equals_should_return_true_when_equals() }; var kmsProviders1 = new Dictionary>() { - { "schemaMapKey", new Dictionary() { { "kmsKey", "kmsValue" } } } + { "schemaMapKey", new Dictionary() { { "kmsKey", "kmsValue" } } } }; var kmsProviders2 = new Dictionary>() { diff --git a/tests/MongoDB.Driver.Tests/Core/ConnectionPools/MaintenanceHelperTests.cs b/tests/MongoDB.Driver.Tests/Core/ConnectionPools/MaintenanceHelperTests.cs index 4e8a23a13fb..acbf426d600 100644 --- a/tests/MongoDB.Driver.Tests/Core/ConnectionPools/MaintenanceHelperTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/ConnectionPools/MaintenanceHelperTests.cs @@ -178,7 +178,7 @@ public void Stop_should_trigger_immediate_maintenance_call( var requestInPlayTimeout = TimeSpan.FromMilliseconds(100); if (!closeInUseConnection && checkOutConnection) { - // connection in progress should be not touched + // connection in progress should be not touched Thread.Sleep(requestInPlayTimeout); } else diff --git a/tests/MongoDB.Driver.Tests/Core/Operations/DropCollectionOperationTests.cs b/tests/MongoDB.Driver.Tests/Core/Operations/DropCollectionOperationTests.cs index 0270c1e811d..84b05bd3731 100644 --- a/tests/MongoDB.Driver.Tests/Core/Operations/DropCollectionOperationTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/Operations/DropCollectionOperationTests.cs @@ -138,7 +138,7 @@ public void CreateEncryptedDropCollectionOperationIfConfigured_should_return_exp var subject = DropCollectionOperation.CreateEncryptedDropCollectionOperationIfConfigured(_collectionNamespace, encryptedFields, _messageEncoderSettings, null); var session = OperationTestHelper.CreateSession(); - + var operations = ((CompositeWriteOperation)subject)._operations(); // esc diff --git a/tests/MongoDB.Driver.Tests/Core/Servers/ServerFactoryTests.cs b/tests/MongoDB.Driver.Tests/Core/Servers/ServerFactoryTests.cs index 08c5f09ce37..ed279786905 100644 --- a/tests/MongoDB.Driver.Tests/Core/Servers/ServerFactoryTests.cs +++ b/tests/MongoDB.Driver.Tests/Core/Servers/ServerFactoryTests.cs @@ -132,7 +132,7 @@ public void CreateServer_should_return_correct_Server(ClusterType clusterType, T { var subject = new ServerFactory(_directConnection, _settings, _connectionPoolFactory, _serverMonitorFactory, _eventSubscriber, _serverApi, null); var clusterClock = new Mock().Object; - + var result = subject.CreateServer(clusterType, _clusterId, clusterClock, _endPoint); diff --git a/tests/MongoDB.Driver.Tests/FindExpressionProjectionDefinitionTests.cs b/tests/MongoDB.Driver.Tests/FindExpressionProjectionDefinitionTests.cs index 018f813209a..ddeb5817e7e 100644 --- a/tests/MongoDB.Driver.Tests/FindExpressionProjectionDefinitionTests.cs +++ b/tests/MongoDB.Driver.Tests/FindExpressionProjectionDefinitionTests.cs @@ -30,7 +30,7 @@ public void Projection_to_class_should_work( [Values(false, true)] bool renderForFind) { var expectedRenderedProjection = renderForFind switch - { + { true => "{ A : 1, X : '$B', _id : 0 }", false => "{ A : '$A', X : '$B', _id : 0 }" }; diff --git a/tests/MongoDB.Driver.Tests/Jira/CSharp4646Tests.cs b/tests/MongoDB.Driver.Tests/Jira/CSharp4646Tests.cs index 7cbb6022ef4..6000c7da53d 100644 --- a/tests/MongoDB.Driver.Tests/Jira/CSharp4646Tests.cs +++ b/tests/MongoDB.Driver.Tests/Jira/CSharp4646Tests.cs @@ -72,7 +72,7 @@ public void Watch_database_filtering_on_collection_name() // some older versions of the server require the database to exist before you can watch it CreateDatabase(database); - + using var changeStream = database.Watch(pipeline); } diff --git a/tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenTargetedFailPointTest.cs b/tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenTargetedFailPointTest.cs index 44f2e342395..08cb6716c5e 100644 --- a/tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenTargetedFailPointTest.cs +++ b/tests/MongoDB.Driver.Tests/JsonDrivenTests/JsonDrivenTargetedFailPointTest.cs @@ -44,7 +44,7 @@ protected async override Task GetFailPointServerAsync() return await TestRunner.FailPointCluster.SelectServerAsync(pinnedServerSelector, CancellationToken.None).ConfigureAwait(false); } - // private methods + // private methods private IServerSelector CreateServerSelector(EndPoint endpoint) { return new CompositeServerSelector(new IServerSelector[] diff --git a/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/DateFromStringMethodToAggregationExpressionTranslatorTests.cs b/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/DateFromStringMethodToAggregationExpressionTranslatorTests.cs index 69dae706333..7725aa0cede 100644 --- a/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/DateFromStringMethodToAggregationExpressionTranslatorTests.cs +++ b/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/DateFromStringMethodToAggregationExpressionTranslatorTests.cs @@ -140,7 +140,7 @@ public void MongoDBFunctions_DateFromString_with_format_and_timezone_and_onError .Where(x => x.Id == id) .Select(x => Mql.DateFromString(x.S, x.F, x.TZ, x.OnError, x.OnNull)); - var expectedStages = + var expectedStages = new[] { $"{{ $match : {{ _id : {id} }} }}", diff --git a/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/OrderByMethodToAggregationExpressionTranslatorTests.cs b/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/OrderByMethodToAggregationExpressionTranslatorTests.cs index 5e07a2240ad..d1562671d4e 100644 --- a/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/OrderByMethodToAggregationExpressionTranslatorTests.cs +++ b/tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Translators/ExpressionToAggregationExpressionTranslators/MethodTranslators/OrderByMethodToAggregationExpressionTranslatorTests.cs @@ -161,7 +161,7 @@ private class C public class A { - public A(int x, int y) { X = x; Y = y; } + public A(int x, int y) { X = x; Y = y; } public int X { get; set; } public int Y { get; set; } } diff --git a/tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs b/tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs index 982cb8b5c49..798648fceec 100644 --- a/tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs +++ b/tests/MongoDB.Driver.Tests/Search/AtlasSearchIndexManagmentTests.cs @@ -101,7 +101,7 @@ public async Task Case3_driver_can_successfully_drop_search_indexes( { _collection.SearchIndexes.DropOne(indexName); } - + while (true) { List indexes; @@ -114,7 +114,7 @@ public async Task Case3_driver_can_successfully_drop_search_indexes( { indexes = _collection.SearchIndexes.List().ToList(); } - + if (indexes.Count == 0) { return; @@ -141,7 +141,7 @@ public async Task Case4_driver_can_update_a_search_index( { _collection.SearchIndexes.Update(indexName, indexNewDefinition); } - + var updatedIndex = await GetIndexes(async, indexName); updatedIndex[0]["latestDefinition"].AsBsonDocument.Should().Be(indexNewDefinition); } @@ -177,7 +177,7 @@ public async Task Case6_driver_can_create_and_list_search_indexes_with_non_defau var indexNameCreated = async ? await collection.SearchIndexes.CreateOneAsync(_indexDefinition, indexName) : collection.SearchIndexes.CreateOne(_indexDefinition, indexName); - + indexNameCreated.Should().Be(indexName); var indexes = await GetIndexes(async, indexName); @@ -218,7 +218,7 @@ public async Task Case7_driver_can_handle_search_index_types_when_creating_index ? await _collection.SearchIndexes.CreateOneAsync(new CreateSearchIndexModel(indexName3, SearchIndexType.VectorSearch, _vectorIndexDefinition)) : _collection.SearchIndexes.CreateOne(new CreateSearchIndexModel(indexName3, SearchIndexType.VectorSearch, _vectorIndexDefinition)); indexNameCreated.Should().Be(indexName3); - + var indexCreated3 = await GetIndexes(async, indexName3); indexCreated3[0]["type"].AsString.Should().Be("vectorSearch"); } @@ -233,7 +233,7 @@ public async Task Case8_driver_requires_explicit_type_to_create_vector_search_in var exception = async ? await Record.ExceptionAsync(() => _collection.SearchIndexes.CreateOneAsync(_vectorIndexDefinition, indexName)) : Record.Exception(() => _collection.SearchIndexes.CreateOne(_vectorIndexDefinition, indexName)); - + exception.Message.Should().Contain("Attribute mappings missing"); } @@ -242,7 +242,7 @@ private async Task CreateIndexAndValidate(string indexName, BsonDo var indexNameActual = async ? await _collection.SearchIndexes.CreateOneAsync(indexDefinition, indexName) : _collection.SearchIndexes.CreateOne(indexDefinition, indexName); - + indexNameActual.Should().Be(indexName); var result = await GetIndexes(async, indexName); diff --git a/tests/MongoDB.Driver.Tests/Search/AtlasSearchTests.cs b/tests/MongoDB.Driver.Tests/Search/AtlasSearchTests.cs index 450ea20fe26..47d9ad758a2 100644 --- a/tests/MongoDB.Driver.Tests/Search/AtlasSearchTests.cs +++ b/tests/MongoDB.Driver.Tests/Search/AtlasSearchTests.cs @@ -155,7 +155,7 @@ public void EqualsNull() result.Name.Should().Be("testNull"); } - + [Fact] public void EqualsArrayField() { @@ -163,25 +163,25 @@ public void EqualsArrayField() .Search(Builders.Search.Equals(p => p.Genres, "family")) .Limit(3) .ToList(); - + results.Should().HaveCount(3); foreach (var result in results) { result.Genres.Should().Contain("Family"); } - + results[0].Title.Should().Be("The Poor Little Rich Girl"); results[1].Title.Should().Be("Robin Hood"); results[2].Title.Should().Be("Peter Pan"); } - + [Fact] public void EqualsStringField() { var results = GetMoviesCollection().Aggregate() .Search(Builders.Search.Equals(p => p.Title, "a corner in wheat")) .ToList(); - + results.Should().ContainSingle().Which.Title.Should().Be("A Corner in Wheat"); } @@ -469,7 +469,7 @@ public void Range() results.Should().ContainSingle().Which.Name.Should().Be("House close to station & direct to opera house...."); } - + [Fact] public void RangeString() { @@ -478,7 +478,7 @@ public void RangeString() .Limit(5) .Project(Builders.Projection.Include(p => p.Title)) .ToList(); - + results[0].Title.Should().Be("Civilization"); results[1].Title.Should().Be("Clash of the Wolves"); results[2].Title.Should().Be("City Lights"); @@ -848,7 +848,7 @@ public class Movie { [BsonElement("genres")] public string[] Genres { get; set; } - + [BsonElement("title")] public string Title { get; set; } diff --git a/tests/MongoDB.Driver.Tests/Search/SearchDefinitionBuilderTests.cs b/tests/MongoDB.Driver.Tests/Search/SearchDefinitionBuilderTests.cs index 0afd28ea4ee..a4b97c2e7f3 100644 --- a/tests/MongoDB.Driver.Tests/Search/SearchDefinitionBuilderTests.cs +++ b/tests/MongoDB.Driver.Tests/Search/SearchDefinitionBuilderTests.cs @@ -266,12 +266,12 @@ public void EmbeddedDocument_typed() subjectFamily.EmbeddedDocument(p => p.Children, subjectPerson.QueryString(p => p.LastName, "berg")), "{ embeddedDocument: { path : 'Children', operator : { 'queryString' : { defaultPath : 'Children.ln', query : 'berg' } } } }"); } - + [Fact] public void Equals_with_array_should_render_supported_type() { var subjectTyped = CreateSubject(); - + AssertRendered( subjectTyped.Equals(p => p.Hobbies, "soccer"), "{ equals: { path: 'hobbies', value: 'soccer' } }"); @@ -1547,13 +1547,13 @@ public class Person : SimplePerson [BsonElement("ret")] public bool Retired { get; set; } - + [BsonElement("hobbies")] public string[] Hobbies { get; set; } [BsonElement("salaries")] public int[] SalaryHistory { get; set; } - + public object Object { get; set; } public string Name { get; set; } diff --git a/tests/MongoDB.Driver.Tests/Specifications/server-selection/InWindowTestRunner.cs b/tests/MongoDB.Driver.Tests/Specifications/server-selection/InWindowTestRunner.cs index 84abad019de..33b243bc42f 100644 --- a/tests/MongoDB.Driver.Tests/Specifications/server-selection/InWindowTestRunner.cs +++ b/tests/MongoDB.Driver.Tests/Specifications/server-selection/InWindowTestRunner.cs @@ -125,7 +125,7 @@ private MultiServerCluster CreateAndSetupCluster(ClusterDescription clusterDescr serverDescriptionDisconnected = serverDescriptionDisconnected.With(replicaSetConfig: replicaSetConfig); } var serverDescriptionConnected = serverDescriptionDisconnected.With(state: ServerState.Connected); - + var operationsCount = operationsCounts.Single(o => endpoint.ToString().EndsWith(o.address)); diff --git a/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedCloseCursorOperation.cs b/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedCloseCursorOperation.cs index 1e75489e6f8..1eeb6c12b01 100644 --- a/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedCloseCursorOperation.cs +++ b/tests/MongoDB.Driver.Tests/UnifiedTestOperations/UnifiedCloseCursorOperation.cs @@ -87,7 +87,7 @@ public static IAsyncCursor _cursor(this AsyncCursorEnumera } internal static class ChangeStreamCursorReflector - { + { public static IAsyncCursor _cursor(this ChangeStreamCursor> cursor) { return (IAsyncCursor)Reflector.GetFieldValue(cursor, nameof(_cursor));