using FluentAssertions; using SeaHaven.Services.DTOs; using Xunit; namespace SeaHaven.Services.Tests; public class PagedResultTests { [Theory] [InlineData(0, 10, 0)] [InlineData(10, 10, 1)] [InlineData(25, 10, 3)] [InlineData(100, 25, 4)] public void TotalPages_IsCeilingOfCountOverPageSize(int totalCount, int pageSize, int expectedPages) { var result = new PagedResult { TotalCount = totalCount, PageSize = pageSize, Page = 1 }; result.TotalPages.Should().Be(expectedPages); } [Fact] public void HasPrevious_IsFalseOnFirstPage_TrueAfterward() { new PagedResult { Page = 1, PageSize = 10, TotalCount = 30 }.HasPrevious.Should().BeFalse(); new PagedResult { Page = 2, PageSize = 10, TotalCount = 30 }.HasPrevious.Should().BeTrue(); } [Fact] public void HasNext_IsTrueBeforeLastPage_FalseOnLastPage() { new PagedResult { Page = 2, PageSize = 10, TotalCount = 30 }.HasNext.Should().BeTrue(); new PagedResult { Page = 3, PageSize = 10, TotalCount = 30 }.HasNext.Should().BeFalse(); } }