aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-10 22:46:56 +0800
committercrupest <crupest@outlook.com>2022-04-10 22:46:56 +0800
commit727b4655739ee9ee0f3fec7798f8613f7df9eed0 (patch)
tree2b52c93c622874c0f400463951edd83d9b054fa3
parent74bfab88dfdcdc08ee512253a803f2b3016e5f03 (diff)
downloadtimeline-727b4655739ee9ee0f3fec7798f8613f7df9eed0.tar.gz
timeline-727b4655739ee9ee0f3fec7798f8613f7df9eed0.tar.bz2
timeline-727b4655739ee9ee0f3fec7798f8613f7df9eed0.zip
...
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests2/TimelineBookmarkTest.cs50
1 files changed, 50 insertions, 0 deletions
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<TimelineBookmark>(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<TimelineBookmark>(HttpMethod.Get, "users/user/bookmarks/1");
+ b.TimelineName.Should().Be("hello");
+ b.TimelineOwner.Should().Be("user");
+ b.Position.Should().Be(1);
+ }
+ }
+}
+