eliminates region sections

This commit is contained in:
BinaryAlley committed 2024-10-12 22:03:57 +03:00
1 parent 705c02b90d
commit 405fc1ff9a
370 files changed
+47 -1618

No files matched your search

@@ -11,7 +11,6 @@ namespace Lumina.DataAccess.IntegrationTests.Core.Repositories.Common.Factory;
[ExcludeFromCodeCoverage]
public class RepositoryFactoryTests
{
#region ===================================================================== METHODS ===================================================================================
[Fact]
public void RepositoryFactoryImplementsRepositoryFactoryInterface_InterfaceIsImplemented_ReturnsTrue()
{
@@ -21,5 +20,4 @@ public class RepositoryFactoryTests
// Assert
Assert.True(repositoryFactory is IRepositoryFactory);
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.DataAccess.IntegrationTests.Core.UoW;
[ExcludeFromCodeCoverage]
public class UnitOfWorkTests
{
#region ===================================================================== METHODS ===================================================================================
[Fact]
public void UnitOfWorkImplementsUnitOfWorkInterface_InterfaceIsImplemented_ReturnsTrue()
{
@@ -28,5 +27,4 @@ public class UnitOfWorkTests
// Assert
Assert.True(unitOfWork is IUnitOfWork);
}
#endregion
}
@@ -22,7 +22,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Converters;
[ExcludeFromCodeCoverage]
public class BookJsonConverter : JsonConverter<Book>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Reads and converts JSON to a <see cref="Book"/> object.
/// </summary>
@@ -281,5 +280,4 @@ public class BookJsonConverter : JsonConverter<Book>
).Value)
.ToList();
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
[ExcludeFromCodeCoverage]
public static class BogusExtensions
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Adds <see cref="DateOnly"/> random data generation support to the <see cref="Faker"/> class.
/// </summary>
@@ -36,5 +35,4 @@ public static class BogusExtensions
DateTime endDateTime = end.ToDateTime(TimeOnly.MinValue);
return System.DateOnly.FromDateTime(faker.Date.Between(startDateTime, endDateTime));
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
[ExcludeFromCodeCoverage]
public class DateOnlySpecimenBuilder : ISpecimenBuilder
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Adds <see cref="DateOnly"/> support to the AutoFixture library.
/// </summary>
@@ -25,5 +24,4 @@ public class DateOnlySpecimenBuilder : ISpecimenBuilder
return DateOnly.FromDateTime(DateTime.Now);
return new NoSpecimen();
}
#endregion
}
@@ -20,11 +20,8 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
[ExcludeFromCodeCoverage]
public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly SqliteConnection _connection;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="LuminaApiFactory"/> class.
/// </summary>
@@ -33,9 +30,7 @@ public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
_connection = new SqliteConnection("DataSource=:memory:");
_connection.Open();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Configures the web host for the integration tests.
/// </summary>
@@ -69,5 +64,4 @@ public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
_connection.Close();
base.Dispose();
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
[ExcludeFromCodeCoverage]
public class NullableDateOnlySpecimenBuilder : ISpecimenBuilder
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Adds <see cref="DateOnly?"/> support to the AutoFixture library.
/// </summary>
@@ -25,5 +24,4 @@ public class NullableDateOnlySpecimenBuilder : ISpecimenBuilder
return (DateOnly?)DateOnly.FromDateTime(DateTime.Now);
return new NoSpecimen();
}
#endregion
}
@@ -26,7 +26,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class DirectoriesControllerTests : IClassFixture<LuminaApiFactory>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new()
{
@@ -35,9 +34,7 @@ public class DirectoriesControllerTests : IClassFixture<LuminaApiFactory>
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};
private static readonly bool s_isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DirectoriesControllerTests"/> class.
/// </summary>
@@ -46,9 +43,7 @@ public class DirectoriesControllerTests : IClassFixture<LuminaApiFactory>
{
_client = apiFactory.CreateClient();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetDirectoryTree_WhenCalledWithValidPathAndIncludeFilesAndNotIncludeHiddenElements_ShouldReturnDirectoryTreeWithFilesAndNotHiddenElements()
{
@@ -641,5 +636,4 @@ public class DirectoriesControllerTests : IClassFixture<LuminaApiFactory>
fileSystemFixture.CleanupFileSystemStructure();
}
}
#endregion
}
@@ -24,7 +24,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class DrivesControllerTests : IClassFixture<LuminaApiFactory>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new()
{
@@ -33,9 +32,7 @@ public class DrivesControllerTests : IClassFixture<LuminaApiFactory>
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};
private static readonly bool s_isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DrivesControllerTests"/> class.
/// </summary>
@@ -44,9 +41,7 @@ public class DrivesControllerTests : IClassFixture<LuminaApiFactory>
{
_client = apiFactory.CreateClient();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetDrives_WhenCalled_ShouldReturnDrives()
@@ -81,5 +76,4 @@ public class DrivesControllerTests : IClassFixture<LuminaApiFactory>
firstDrive.ItemType.Should().Be(FileSystemItemType.Root);
drives.Count.Should().BeGreaterThanOrEqualTo(1);
}
#endregion
}
@@ -25,7 +25,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class FileSystemControllerTests : IClassFixture<LuminaApiFactory>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new()
{
@@ -33,9 +32,7 @@ public class FileSystemControllerTests : IClassFixture<LuminaApiFactory>
PropertyNameCaseInsensitive = true,
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemControllerTests"/> class.
/// </summary>
@@ -44,9 +41,7 @@ public class FileSystemControllerTests : IClassFixture<LuminaApiFactory>
{
_client = apiFactory.CreateClient();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetType_WhenCalled_ShouldReturnOkResultWithFileSystemTypeResponse()
{
@@ -95,5 +90,4 @@ public class FileSystemControllerTests : IClassFixture<LuminaApiFactory>
// Assert
await act.Should().NotThrowAsync();
}
#endregion
}
@@ -25,7 +25,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class FilesControllerTests : IClassFixture<LuminaApiFactory>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new()
{
@@ -34,9 +33,7 @@ public class FilesControllerTests : IClassFixture<LuminaApiFactory>
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};
private static readonly bool s_isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FilesControllerTests"/> class.
/// </summary>
@@ -45,9 +42,7 @@ public class FilesControllerTests : IClassFixture<LuminaApiFactory>
{
_client = apiFactory.CreateClient();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetTreeFiles_WhenCalledWithValidPathAndNotIncludeHiddenElements_ShouldReturnTreeFilesWithoutHiddenElements()
{
@@ -331,5 +326,4 @@ public class FilesControllerTests : IClassFixture<LuminaApiFactory>
fileSystemFixture.CleanupFileSystemStructure();
}
}
#endregion
}
@@ -13,12 +13,9 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class FileSystemStructureFixture
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly string _rootPath;
private readonly Faker _faker = new();
#endregion
#region ===================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="FileSystemStructureFixture"/> class.
/// </summary>
@@ -26,9 +23,7 @@ public class FileSystemStructureFixture
{
_rootPath = Path.Combine(AppContext.BaseDirectory, "TestFileSystemStructure_" + Guid.NewGuid());
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a file system structure with three nested directories, each containing two text files.
@@ -93,5 +88,4 @@ public class FileSystemStructureFixture
if (Directory.Exists(_rootPath))
Directory.Delete(_rootPath, recursive: true);
}
#endregion
}
@@ -15,11 +15,8 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class FileSystemTreeNodeResponseFixture
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly Faker _faker = new();
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a single <see cref="FileSystemTreeNodeResponse"/> with a nested structure.
/// </summary>
@@ -58,5 +55,4 @@ public class FileSystemTreeNodeResponseFixture
{
return Enumerable.Range(0, count).Select(_ => Create(0, maxDepth, maxChildren)).ToList();
}
#endregion
}
@@ -15,14 +15,11 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class TestImageFixture : IDisposable
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the path of the created test image.
/// </summary>
public string ImagePath { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="TestImageFixture"/> class.
/// </summary>
@@ -31,9 +28,7 @@ public class TestImageFixture : IDisposable
ImagePath = Path.Combine(Path.GetTempPath(), $"TestImage_{Guid.NewGuid()}.jpg");
CreateTestImage();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a test image file.
/// </summary>
@@ -51,5 +46,4 @@ public class TestImageFixture : IDisposable
if (File.Exists(ImagePath))
File.Delete(ImagePath);
}
#endregion
}
@@ -26,7 +26,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class PathControllerTests : IClassFixture<LuminaApiFactory>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new()
{
@@ -35,9 +34,7 @@ public class PathControllerTests : IClassFixture<LuminaApiFactory>
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};
private static readonly bool s_isLinux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="PathControllerTests"/> class.
/// </summary>
@@ -46,9 +43,7 @@ public class PathControllerTests : IClassFixture<LuminaApiFactory>
{
_client = apiFactory.CreateClient();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetPathRoot_WhenCalledWithValidPath_ShouldReturnOkResultWithPathSegmentResponse()
{
@@ -636,5 +631,4 @@ public class PathControllerTests : IClassFixture<LuminaApiFactory>
// Assert
await act.Should().ThrowAsync<TaskCanceledException>();
}
#endregion
}
@@ -21,7 +21,6 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.FileManageme
[ExcludeFromCodeCoverage]
public class ThumbnailsControllerTests : IClassFixture<LuminaApiFactory>, IClassFixture<TestImageFixture>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly HttpClient _client;
private readonly JsonSerializerOptions _jsonOptions = new()
{
@@ -30,9 +29,7 @@ public class ThumbnailsControllerTests : IClassFixture<LuminaApiFactory>, IClass
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
};
private readonly string _testImagePath;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ThumbnailsControllerTests"/> class.
/// </summary>
@@ -43,9 +40,7 @@ public class ThumbnailsControllerTests : IClassFixture<LuminaApiFactory>, IClass
_client = apiFactory.CreateClient();
_testImagePath = imageFixture.ImagePath;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetThumbnail_WhenCalledWithValidPathAndQuality_ShouldReturnOkResultWithThumbnail()
{
@@ -132,5 +127,4 @@ public class ThumbnailsControllerTests : IClassFixture<LuminaApiFactory>, IClass
// Assert
await act.Should().ThrowAsync<TaskCanceledException>();
}
#endregion
}
@@ -28,14 +28,11 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.WrittenConte
[ExcludeFromCodeCoverage]
public class BooksControllerTests : IClassFixture<LuminaApiFactory>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly LuminaApiFactory _apiFactory;
private readonly HttpClient _client;
private readonly AddBookRequestFixture _requestBookFixture;
private readonly JsonSerializerOptions _jsonOptions = new();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BooksControllerTests"/> class.
/// </summary>
@@ -47,9 +44,7 @@ public class BooksControllerTests : IClassFixture<LuminaApiFactory>
_requestBookFixture = new AddBookRequestFixture();
_jsonOptions.Converters.Add(new BookJsonConverter());
}
#endregion
#region ===================================================================== METHODS ===================================================================================
[Fact]
public async Task GetBooks_WhenCalled_ShouldReturnBooks()
{
@@ -1615,5 +1610,4 @@ public class BooksControllerTests : IClassFixture<LuminaApiFactory>
response.StatusCode.Should().Be(HttpStatusCode.Created);
bookResponse.Should().NotBeNull();
}
#endregion
}
@@ -22,13 +22,10 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.Books.Fixtur
[ExcludeFromCodeCoverage]
public class AddBookRequestFixture
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly Fixture _fixture;
private readonly Random _random = new();
private readonly Faker _faker;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AddBookRequestFixture"/> class.
/// </summary>
@@ -39,9 +36,7 @@ public class AddBookRequestFixture
_fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
_faker = new Faker();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a random valid request to add a book.
/// </summary>
@@ -345,5 +340,4 @@ public class AddBookRequestFixture
{
return input?.Length > maxLength ? input[..maxLength] : input;
}
#endregion
}
@@ -21,11 +21,8 @@ namespace Lumina.Presentation.Api.IntegrationTests.Core.Controllers.Books.Fixtur
[ExcludeFromCodeCoverage]
public class DomainBookFixture
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly Fixture _fixture;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="DomainBookFixture"/> class.
/// </summary>
@@ -36,9 +33,7 @@ public class DomainBookFixture
_fixture.Customizations.Add(new NullableDateOnlySpecimenBuilder());
ConfigureCustomDomainTypes();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
public Book CreateDomainBook()
{
return Book.Create(
@@ -109,5 +104,4 @@ public class DomainBookFixture
_fixture.Create<Optional<int>>()
).Value);
}
#endregion
}