mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 08:11:10 +00:00
Renames project paths from Lumina to Nemera
This commit is contained in:
1 parent
ce6fddb4c9
commit
0f659a4877
6450 files changed
No files matched your search
+30
@@ -0,0 +1,30 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.Common.Filtering;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.DTO.Common.Filtering;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="LibraryFilterDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class LibraryFilterDtoTests
|
||||
{
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenDeserializingJsonWithoutLibraryId_ShouldThrowJsonException()
|
||||
{
|
||||
// Arrange
|
||||
string json = """{ "searchTerm": "fantasy" }""";
|
||||
|
||||
// Act & Assert
|
||||
Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<LibraryFilterDto>(json, _jsonOptions));
|
||||
}
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.DTO.Common.Pagination;
|
||||
using Lumina.Contracts.Fixtures.Core.DTO.Common.Pagination;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.DTO.Common.Pagination;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PaginationDataDto"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PaginationDataDtoTests
|
||||
{
|
||||
private readonly PaginationDataDtoFixture _paginationDataDtoFixture = new();
|
||||
|
||||
[Fact]
|
||||
public void CurrentPage_WhenNotSet_ShouldDefaultToOne()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
int currentPage = sut.CurrentPage;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1, currentPage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PerPage_WhenNotSet_ShouldDefaultToTwoHundred()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
int perPage = sut.PerPage;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(200, perPage);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // Zero is below the minimum.
|
||||
[InlineData(-5)] // Negative values are below the minimum.
|
||||
public void CurrentPage_WhenSettingValueBelowOne_ShouldClampToOne(int value)
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.CurrentPage = value;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1, sut.CurrentPage);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // Zero is below the minimum.
|
||||
[InlineData(-10)] // Negative values are below the minimum.
|
||||
public void PerPage_WhenSettingValueBelowOne_ShouldClampToOne(int value)
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.PerPage = value;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(1, sut.PerPage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CurrentPage_WhenSettingValueAboveOne_ShouldPreserveValue()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.CurrentPage = 5;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(5, sut.CurrentPage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PerPage_WhenSettingValueAboveOne_ShouldPreserveValue()
|
||||
{
|
||||
// Arrange
|
||||
PaginationDataDto sut = _paginationDataDtoFixture.Create(includeCurrentPage: false, includePerPage: false);
|
||||
|
||||
// Act
|
||||
sut.PerPage = 25;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(25, sut.PerPage);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user