From 727b4655739ee9ee0f3fec7798f8613f7df9eed0 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 10 Apr 2022 22:46:56 +0800 Subject: ... --- .../IntegratedTests2/TimelineBookmarkTest.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs (limited to 'BackEnd') diff --git a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs new file mode 100644 index 00000000..fcf69364 --- /dev/null +++ b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs @@ -0,0 +1,50 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Threading.Tasks; +using FluentAssertions; +using Timeline.Models; +using Timeline.Models.Http; +using Xunit; +using Xunit.Abstractions; + +namespace Timeline.Tests.IntegratedTests2 +{ + public class TimelineBookmarkTest : IntegratedTestBase + { + public TimelineBookmarkTest(ITestOutputHelper testOutput) : base(testOutput) + { + } + + protected override async Task OnInitializeAsync() + { + using var client = CreateClientAsUser(); + await client.TestJsonSendAsync(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + + } + + [Fact] + public async Task CreateAndGet() + { + using var client = CreateClientAsUser(); + var a = await client.TestJsonSendAsync(HttpMethod.Post, "users/user/bookmarks", new HttpTimelineBookmarkCreateRequest + { + TimelineOwner = "user", + TimelineName = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + + a.TimelineOwner.Should().Be("user"); + a.TimelineName.Should().Be("hello"); + a.Position.Should().Be(1); + + var b = await client.TestJsonSendAsync(HttpMethod.Get, "users/user/bookmarks/1"); + b.TimelineName.Should().Be("hello"); + b.TimelineOwner.Should().Be("user"); + b.Position.Should().Be(1); + } + } +} + -- cgit v1.2.3