diff options
author | crupest <crupest@outlook.com> | 2019-11-18 19:43:33 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2019-11-18 19:43:33 +0800 |
commit | f927dcf674094857ba9729789ed0a5b272495332 (patch) | |
tree | 6280d70a821b3b5248817c29c58c2365ad1f63d9 /Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs | |
parent | 468d7f4c416d4469375b7170beb5e388737c0970 (diff) | |
download | timeline-f927dcf674094857ba9729789ed0a5b272495332.tar.gz timeline-f927dcf674094857ba9729789ed0a5b272495332.tar.bz2 timeline-f927dcf674094857ba9729789ed0a5b272495332.zip |
Continue to write tests.
Diffstat (limited to 'Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs')
-rw-r--r-- | Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs b/Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs index aaa6215c..2e5b86fa 100644 --- a/Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs +++ b/Timeline.Tests/IntegratedTests/PersonalTimelineTest.cs @@ -24,6 +24,55 @@ namespace Timeline.Tests.IntegratedTests } [Fact] + public async Task TimelineGet_Should_Work() + { + using var client = Factory.CreateDefaultClient(); + var res = await client.GetAsync("users/user/timeline"); + var body = res.Should().HaveStatusCode(200) + .And.HaveJsonBody<BaseTimelineInfo>().Which; + body.Owner.Should().Be("user"); + body.Visibility.Should().Be(TimelineVisibility.Register); + body.Description.Should().Be(""); + body.Members.Should().NotBeNull().And.BeEmpty(); + } + + [Fact] + public async Task Description_Should_Work() + { + using var client = await Factory.CreateClientAsUser(); + + async Task AssertDescription(string description) + { + var res = await client.GetAsync("users/user/timeline"); + var body = res.Should().HaveStatusCode(200) + .And.HaveJsonBody<BaseTimelineInfo>() + .Which.Description.Should().Be(description); + } + + const string mockDescription = "haha"; + + await AssertDescription(""); + { + var res = await client.PostAsJsonAsync("users/user/timeline/op/property", + new TimelinePropertyChangeRequest { Description = mockDescription }); + res.Should().HaveStatusCode(200); + await AssertDescription(mockDescription); + } + { + var res = await client.PostAsJsonAsync("users/user/timeline/op/property", + new TimelinePropertyChangeRequest { Description = null }); + res.Should().HaveStatusCode(200); + await AssertDescription(mockDescription); + } + { + var res = await client.PostAsJsonAsync("users/user/timeline/op/property", + new TimelinePropertyChangeRequest { Description = "" }); + res.Should().HaveStatusCode(200); + await AssertDescription(""); + } + } + + [Fact] public async Task Member_Should_Work() { const string getUrl = "users/user/timeline"; |