Skip to content

Commit

Permalink
Comply with the current search limitation, #121
Browse files Browse the repository at this point in the history
  • Loading branch information
Zechiax committed Apr 22, 2024
1 parent 5c55654 commit b7e8e0c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/Modrinth.Net.Test/ModrinthApiTests/SearchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public async Task Search_WithFabricSearchTerm_ShouldReturnNonEmptyList()

// Test different limit values
[Test]
[TestCase((ulong) 0)]
[TestCase((ulong) 1)]
[TestCase((ulong) 5)]
[TestCase((ulong) 10)]
Expand All @@ -56,6 +55,12 @@ public async Task Search_WithLimit_ShouldReturnLimitedList(ulong limit)
Assert.That(search.Hits, Is.Not.Empty);
});
}

[Test]
public void Search_WithLimit0_ShouldThrowException()
{
Assert.ThrowsAsync<ArgumentOutOfRangeException>(async () => await Client.Project.SearchAsync("", limit: 0));
}

// Test different offset values
[Test]
Expand All @@ -66,7 +71,7 @@ public async Task Search_WithLimit_ShouldReturnLimitedList(ulong limit)
public async Task Search_WithOffset_ShouldReturnOffsetList(ulong offset)
{
var search = await Client.Project.SearchAsync("", limit: offset + 5);
var searchWithOffset = await Client.Project.SearchAsync("", offset: offset, limit: offset + 5);
var searchWithOffset = await Client.Project.SearchAsync("", offset: offset, limit: offset);

// Check that the offset list is not the same as the original list
Assert.That(searchWithOffset.Hits, Is.Not.EqualTo(search.Hits));
Expand Down

0 comments on commit b7e8e0c

Please sign in to comment.