Renames project paths from Lumina to Nemera

This commit is contained in:
BinaryAlley committed 2026-11-27 15:34:43 +02:00
1 parent ce6fddb4c9
commit 0f659a4877
6450 files changed

No files matched your search

@@ -0,0 +1,58 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Plugins.Contracts.Core.Reading;
using Lumina.Plugins.Pdf.Common.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Plugins.Pdf.UnitTests.Common.DependencyInjection;
/// <summary>
/// Contains unit tests for the <see cref="PdfServices"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class PdfServicesTests
{
[Fact]
public void AddPdfReader_WhenServicesIsNull_ShouldThrowArgumentNullException()
{
// Arrange
IServiceCollection services = null!;
// Act
Action act = () => services.AddPdfReader(pluginId: Guid.NewGuid());
// Assert
Assert.Throws<ArgumentNullException>(act);
}
[Fact]
public void AddPdfReader_WhenCalled_ShouldReturnTheSameServiceCollection()
{
// Arrange
ServiceCollection services = new();
// Act
IServiceCollection result = services.AddPdfReader(pluginId: Guid.NewGuid());
// Assert
Assert.Same(services, result);
}
[Fact]
public void AddPdfReader_WhenCalled_ShouldRegisterTheBookReaderForKeyedResolution()
{
// Arrange
Guid pluginId = Guid.NewGuid();
ServiceCollection services = new();
// Act
services.AddPdfReader(pluginId: pluginId);
ServiceProvider serviceProvider = services.BuildServiceProvider();
// Assert
Assert.NotNull(serviceProvider.GetKeyedService<IBookReader>(pluginId));
Assert.Null(serviceProvider.GetKeyedService<IBookReader>(Guid.NewGuid()));
}
}
@@ -0,0 +1,47 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Plugins.Pdf.Core.Pdf;
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.Versioning;
using System.Threading;
#endregion
namespace Lumina.Plugins.Pdf.UnitTests.Core.Pdf;
/// <summary>
/// Contains unit tests for the <see cref="PdfDocumentParser"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class PdfDocumentParserTests
{
[SupportedOSPlatform("windows")]
[Fact]
public void RenderResource_WhenResourceKeyDoesNotIdentifyAPage_ShouldThrowInvalidDataException()
{
// Arrange
// The resource key is rejected before RenderResource opens the PDF, so the path never needs to exist.
string missingPdfPath = "missing.pdf";
// Act
Action act = () => PdfDocumentParser.RenderResource(missingPdfPath, "not-a-page", CancellationToken.None);
// Assert
Assert.Throws<InvalidDataException>(act);
}
[SupportedOSPlatform("windows")]
[Fact]
public void RenderResource_WhenResourceKeyNamesAPageBeyondThePageCap_ShouldThrowInvalidDataException()
{
// Arrange
// The page cap is enforced before RenderResource opens the PDF, so the path never needs to exist.
string missingPdfPath = "missing.pdf";
// Act
Action act = () => PdfDocumentParser.RenderResource(missingPdfPath, "page:10001", CancellationToken.None);
// Assert
Assert.Throws<InvalidDataException>(act);
}
}
@@ -0,0 +1,96 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Plugins.Contracts.Common.Models.DTO.Settings;
using Lumina.Plugins.Contracts.Core.Reading;
using Lumina.Plugins.Pdf.Core;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Plugins.Pdf.UnitTests.Core;
/// <summary>
/// Contains unit tests for the <see cref="PdfPlugin"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class PdfPluginTests
{
private readonly PdfPlugin _sut = new();
[Fact]
public void Id_WhenCalled_ShouldReturnStablePluginIdentifier()
{
// Act
Guid result = _sut.Id;
// Assert
Assert.Equal(PdfPlugin.s_pluginId, result);
Assert.Equal(new Guid("c2f9b8f0-5a4b-4e3d-8b2f-7e4a9c1d3e5f"), result);
}
[Fact]
public void Name_WhenCalled_ShouldReturnPluginDisplayName()
{
// Act
string result = _sut.Name;
// Assert
Assert.Equal("PDF Reader", result);
}
[Fact]
public void Author_WhenCalled_ShouldReturnPluginAuthor()
{
// Act
string result = _sut.Author;
// Assert
Assert.Equal("Lumina", result);
}
[Fact]
public void Version_WhenCalled_ShouldReturnPluginVersion()
{
// Act
Version result = _sut.Version;
// Assert
Assert.Equal(new Version(1, 0, 0), result);
}
[Fact]
public void Description_WhenCalled_ShouldReturnPluginDescription()
{
// Act
string result = _sut.Description;
// Assert
Assert.Equal("Allows reading of PDF format books.", result);
}
[Fact]
public void GetSettingsSchema_WhenCalled_ShouldReturnEmptySettingsSchema()
{
// Act
IReadOnlyList<PluginSettingDescriptorDto> result = _sut.GetSettingsSchema();
// Assert
Assert.Empty(result);
}
[Fact]
public void RegisterServices_WhenCalled_ShouldRegisterTheKeyedBookReader()
{
// Arrange
ServiceCollection services = new();
// Act
_sut.RegisterServices(services);
ServiceProvider serviceProvider = services.BuildServiceProvider();
// Assert
Assert.NotNull(serviceProvider.GetKeyedService<IBookReader>(PdfPlugin.s_pluginId));
Assert.Null(serviceProvider.GetKeyedService<IBookReader>(Guid.NewGuid()));
}
}
@@ -0,0 +1,37 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using Lumina.Plugins.Pdf.Core;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
#endregion
namespace Lumina.Plugins.Pdf.UnitTests.Core;
/// <summary>
/// Contains unit tests for the <see cref="PdfReader"/> class.
/// </summary>
[ExcludeFromCodeCoverage]
public class PdfReaderTests
{
private readonly PdfReader _sut = new();
[Fact]
public void SupportedExtensions_WhenAccessed_ShouldOnlyContainPdf()
{
// Act
IReadOnlyList<string> result = _sut.SupportedExtensions;
// Assert
Assert.Equal([".pdf"], result);
}
[Fact]
public void SupportedLibraryTypes_WhenAccessed_ShouldContainEBookAndBook()
{
// Act
IReadOnlyList<LibraryType> result = _sut.SupportedLibraryTypes;
// Assert
Assert.Equal([LibraryType.EBook, LibraryType.Book], result);
}
}
@@ -0,0 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="Xunit.CollectionBehaviorAttribute">
<_Parameter1>DisableTestParallelization = true</_Parameter1>
<_Parameter1_IsLiteral>true</_Parameter1_IsLiteral>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoFixture.AutoNSubstitute" />
<PackageReference Include="AutoFixture.Xunit2" />
<PackageReference Include="Bogus" />
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\plugins\Lumina.Plugins.Pdf\Lumina.Plugins.Pdf.csproj" />
<ProjectReference Include="..\..\..\src\Lumina.Plugins.Contracts\Lumina.Plugins.Contracts.csproj" />
<ProjectReference Include="..\..\Common\Lumina.Contracts.Fixtures\Lumina.Contracts.Fixtures.csproj" />
<ProjectReference Include="..\..\Common\Lumina.Plugins.Pdf.Fixtures\Lumina.Plugins.Pdf.Fixtures.csproj" />
</ItemGroup>
</Project>