mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 18:11:10 +00:00
31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
#region ========================================================================= USING =====================================================================================
|
|
using Lumina.Contracts.Responses.Common;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Text.Json;
|
|
#endregion
|
|
|
|
namespace Lumina.Contracts.UnitTests.Responses.Common;
|
|
|
|
/// <summary>
|
|
/// Contains unit tests for the <see cref="PaginatedResponse{TData}"/> record.
|
|
/// </summary>
|
|
[ExcludeFromCodeCoverage]
|
|
public class PaginatedResponseTests
|
|
{
|
|
private readonly JsonSerializerOptions _jsonOptions = new()
|
|
{
|
|
PropertyNameCaseInsensitive = true
|
|
};
|
|
|
|
[Fact]
|
|
public void Deserialize_WhenDataIsMissing_ShouldThrowJsonException()
|
|
{
|
|
// Arrange
|
|
string json = """{ "currentPage": 1, "perPage": 10, "count": 0, "numberOfPages": 0 }""";
|
|
|
|
// Act & Assert
|
|
Assert.Throws<JsonException>(() => JsonSerializer.Deserialize<PaginatedResponse<int>>(json, _jsonOptions));
|
|
}
|
|
}
|