diff options
author | crupest <crupest@outlook.com> | 2021-02-04 22:03:08 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-02-04 22:04:39 +0800 |
commit | 66658abde1220a53d0e022aaac8dd49a15034a34 (patch) | |
tree | c8712a2d8fc5e979dae64ea9bfcf590198429039 /BackEnd/Timeline.Tests | |
parent | 90c74a29bb0bdc6972deb188fa13a8ec5c2870ed (diff) | |
download | timeline-66658abde1220a53d0e022aaac8dd49a15034a34.tar.gz timeline-66658abde1220a53d0e022aaac8dd49a15034a34.tar.bz2 timeline-66658abde1220a53d0e022aaac8dd49a15034a34.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs index f05ed7af..b4ddcb43 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/TimelinePostTest.cs @@ -491,6 +491,8 @@ namespace Timeline.Tests.IntegratedTests Color = "#1"
});
+ long id;
+
{
var post = await client.TestPostAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts", new HttpTimelinePostCreateRequest
{
@@ -498,7 +500,40 @@ namespace Timeline.Tests.IntegratedTests Color = "#aabbcc"
});
post.Color.Should().Be("#aabbcc");
+ id = post.Id;
}
+
+ {
+ var post = await client.TestGetAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts/{id}");
+ post.Color.Should().Be("#aabbcc");
+ }
+ }
+
+ [Theory]
+ [MemberData(nameof(TimelineNameGeneratorTestData))]
+ public async Task GetPost(TimelineNameGenerator generator)
+ {
+ using var client = await CreateClientAsUser();
+
+ HttpTimelinePostCreateRequestContent CreateRequestContent() => new()
+ {
+ Type = "text",
+ Text = "aaa"
+ };
+
+ await client.TestGetAssertNotFoundAsync($"timelines/{generator(1)}/posts/1");
+
+ var post = await client.TestPostAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts", new HttpTimelinePostCreateRequest
+ {
+ Content = CreateRequestContent(),
+ });
+
+ var post2 = await client.TestGetAsync<HttpTimelinePost>($"timelines/{generator(1)}/posts/{post.Id}");
+ post2.Should().BeEquivalentTo(post);
+
+ await client.TestDeleteAsync($"timelines/{generator(1)}/posts/{post.Id}");
+
+ await client.TestGetAssertNotFoundAsync($"timelines/{generator(1)}/posts/{post.Id}");
}
}
}
|