diff options
author | crupest <crupest@outlook.com> | 2021-05-13 15:53:08 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-05-13 15:53:08 +0800 |
commit | c667c722ec081dfb651d3583236d7aa429c56941 (patch) | |
tree | 9e3da51562130f16234b6d00c210aa471d90eeed /BackEnd/Timeline.Tests | |
parent | 6b19be9d57d06d9a079ed8f947d44628421bef18 (diff) | |
download | timeline-c667c722ec081dfb651d3583236d7aa429c56941.tar.gz timeline-c667c722ec081dfb651d3583236d7aa429c56941.tar.bz2 timeline-c667c722ec081dfb651d3583236d7aa429c56941.zip |
feat: Posts pagination.
Diffstat (limited to 'BackEnd/Timeline.Tests')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs index c918f793..097275b0 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs @@ -634,5 +634,23 @@ namespace Timeline.Tests.IntegratedTests await client.TestDeleteAsync($"timelines/{generator(1)}/posts/{post.Id}");
}
}
+
+ [Theory]
+ [MemberData(nameof(TimelineNameGeneratorTestData))]
+ public async Task Post_List_Pagination_Test(TimelineNameGenerator generator)
+ {
+ using var client = await CreateClientAsUser();
+ var posts = new List<HttpTimelinePost>();
+ for (int i = 0; i < 50; i++)
+ {
+ var post = await client.TestPostAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts", CreateTextPostRequest(i.ToString()));
+ posts.Add(post);
+ }
+
+ {
+ var p = await client.TestGetAsync<List<HttpTimelinePost>>($"timelines/{generator(1)}/posts?page=2&numberPerPage=10");
+ p.Should().BeEquivalentTo(posts.Skip(10).Take(10));
+ }
+ }
}
}
|