(refactor): review namespaces

This commit is contained in:
Maksym Sadovnychyy 2025-06-09 23:40:03 +02:00
parent e5898dbfe7
commit fa1e270882
15 changed files with 1361 additions and 1362 deletions

View File

@ -10,7 +10,7 @@ using MaksIT.MongoDB.Linq.Utilities;
using MaksIT.MongoDB.Linq.Tests.Mock;
namespace MaksIT.MongoDB.Tests {
namespace MaksIT.MongoDB.Tests;
// Sample DTO class for testing
public class TestableDocumentDto : DtoDocumentBase<Guid> {
@ -342,9 +342,3 @@ namespace MaksIT.MongoDB.Tests {
Assert.Contains(queryResult, doc => doc.Name == "Document 2");
}
}
}

View File

@ -1,6 +1,7 @@
using MongoDB.Driver;
namespace MaksIT.MongoDB.Linq.Tests.Mock {
namespace MaksIT.MongoDB.Linq.Tests.Mock;
internal class MongoAsyncCursorMock<T>(List<T> documents) : IAsyncCursor<T> {
public IEnumerable<T> Current => documents;
@ -17,4 +18,3 @@ namespace MaksIT.MongoDB.Linq.Tests.Mock {
}
}
}

View File

@ -2,7 +2,7 @@
using MongoDB.Driver;
using MongoDB.Driver.Core.Clusters;
namespace MaksIT.MongoDB.Linq.Tests.Mock {
namespace MaksIT.MongoDB.Linq.Tests.Mock;
internal class MongoClientMock : IMongoClient {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
@ -160,4 +160,3 @@ namespace MaksIT.MongoDB.Linq.Tests.Mock {
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
}

View File

@ -2,7 +2,8 @@
using MongoDB.Driver;
using MongoDB.Driver.Search;
namespace MaksIT.MongoDB.Linq.Tests.Mock {
namespace MaksIT.MongoDB.Linq.Tests.Mock;
internal class MongoCollectionMock<TDocument> : IMongoCollection<TDocument> {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
@ -406,4 +407,4 @@ namespace MaksIT.MongoDB.Linq.Tests.Mock {
#pragma warning restore CS0618 // Type or member is obsolete
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
}

View File

@ -1,7 +1,9 @@
using MongoDB.Bson;
using MongoDB.Driver;
namespace MaksIT.MongoDB.Linq.Tests.Mock {
namespace MaksIT.MongoDB.Linq.Tests.Mock;
internal class MongoDatabaseMock : IMongoDatabase {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
@ -218,4 +220,3 @@ namespace MaksIT.MongoDB.Linq.Tests.Mock {
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
}

View File

@ -3,7 +3,9 @@ using MongoDB.Driver;
using MongoDB.Driver.Core.Bindings;
using MongoDB.Driver.Core.Clusters;
namespace MaksIT.MongoDB.Linq.Tests {
namespace MaksIT.MongoDB.Linq.Tests;
internal class MongoSessionMock : IClientSessionHandle {
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
@ -90,4 +92,3 @@ namespace MaksIT.MongoDB.Linq.Tests {
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
}
}

View File

@ -3,7 +3,9 @@
using MaksIT.Results;
using MaksIT.MongoDB.Linq.Tests.Mock;
namespace MaksIT.MongoDB.Linq.Tests {
namespace MaksIT.MongoDB.Linq.Tests;
public class MongoSessionManagerTests {
private readonly MongoSessionManager _sessionManager;
@ -63,4 +65,3 @@ namespace MaksIT.MongoDB.Linq.Tests {
Assert.False(result.IsSuccess);
}
}
}

View File

@ -1,6 +1,8 @@
using MaksIT.MongoDB.Linq.Utilities;
namespace MaksIT.MongoDB.Linq.Tests.Utilities {
namespace MaksIT.MongoDB.Linq.Tests.Utilities;
public class CombGuidGeneratorTests {
[Fact]
public void CreateCombGuid_WithCurrentTimestamp_ShouldGenerateGuid() {
@ -78,4 +80,3 @@ namespace MaksIT.MongoDB.Linq.Tests.Utilities {
Assert.Null(exception); // Adjusted expectation based on behavior of `ExtractTimestamp` with a regular GUID
}
}
}

View File

@ -7,7 +7,8 @@ using MaksIT.Core.Abstractions.Dto;
using MaksIT.Results;
namespace MaksIT.MongoDB.Linq.Abstractions {
namespace MaksIT.MongoDB.Linq.Abstractions;
public abstract class BaseCollectionDataProviderBase<T, TDtoDocument, TDtoKey> : DataProviderBase<T>
where TDtoDocument : DtoDocumentBase<TDtoKey> {
@ -237,4 +238,4 @@ namespace MaksIT.MongoDB.Linq.Abstractions {
}
#endregion
}
}

View File

@ -7,7 +7,8 @@ using MongoDB.Driver;
using MaksIT.Results;
using MaksIT.Core.Abstractions.Dto;
namespace MaksIT.MongoDB.Linq.Abstractions {
namespace MaksIT.MongoDB.Linq.Abstractions;
public abstract class CollectionDataProviderBase<T, TDtoDocument, TDtoKey> : BaseCollectionDataProviderBase<T, TDtoDocument, TDtoKey>
where TDtoDocument : DtoDocumentBase<TDtoKey> {
@ -123,4 +124,3 @@ namespace MaksIT.MongoDB.Linq.Abstractions {
DeleteManyWithPredicateAsync(predicate, session).Result;
#endregion
}
}

View File

@ -1,7 +1,9 @@
using Microsoft.Extensions.Logging;
using MongoDB.Driver;
namespace MaksIT.MongoDB.Linq.Abstractions {
namespace MaksIT.MongoDB.Linq.Abstractions;
public abstract class DataProviderBase<T> {
protected readonly ILogger<T> Logger;
protected readonly IMongoDatabase Database;
@ -16,4 +18,3 @@ namespace MaksIT.MongoDB.Linq.Abstractions {
Database = _client.GetDatabase(databaseName);
}
}
}

View File

@ -4,11 +4,11 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>MaksIT.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<!-- NuGet package metadata -->
<PackageId>MaksIT.MongoDB.Linq</PackageId>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<Authors>Maksym Sadovnychyy</Authors>
<Company>MAKS-IT</Company>
<Product>MaksIT.MongoDB.Linq</Product>

View File

@ -1,5 +1,5 @@
using MongoDB.Driver;
using System;
namespace MaksIT.MongoDB.Linq {
public class DisposableMongoSession : IDisposable {

View File

@ -4,7 +4,7 @@ using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Serializers;
namespace MaksIT.MaksIT.MongoDB.Linq.Serializers;
namespace MaksIT.MongoDB.Linq.Serializers;
public class GuidKeyDictionarySerializer<TValue> : SerializerBase<Dictionary<Guid, TValue>> {
public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, Dictionary<Guid, TValue> value) {

View File

@ -1,5 +1,4 @@
using System;
using System.Buffers.Binary;
using System.Buffers.Binary;
namespace MaksIT.MongoDB.Linq.Utilities {
public static class CombGuidGenerator {