fix: only allow afterId or beforeId to be set. not both at same time.
This commit is contained in:
@@ -18,6 +18,14 @@ public class PagingRequestTests : SerializationTest
|
||||
act.Should().Throw<ArgumentOutOfRangeException>().WithMessage("limit must be between 1 and 1000. (Parameter 'limit')");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenBothBeforeIdAndAfterIdAreSet_ItShouldThrowArgumentException()
|
||||
{
|
||||
var act = () => new PagingRequest(beforeId: "before-id", afterId: "after-id");
|
||||
|
||||
act.Should().Throw<ArgumentException>().WithMessage("Only one of beforeId or afterId can be set.");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQueryParameters_WhenNoPropertiesSet_ItShouldReturnEmptyString()
|
||||
{
|
||||
@@ -57,14 +65,4 @@ public class PagingRequestTests : SerializationTest
|
||||
|
||||
result.Should().Be("limit=10");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToQueryParameters_WhenAllPropertiesAreSet_ItShouldReturnAllProperties()
|
||||
{
|
||||
var pagingRequest = new PagingRequest(beforeId: "before-id", afterId: "after-id", limit: 10);
|
||||
|
||||
var result = pagingRequest.ToQueryParameters();
|
||||
|
||||
result.Should().Be("before_id=before-id&after_id=after-id&limit=10");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user