From 0bb2cc098506963ebf9ee06ec94b43c8d388543c Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 7 Jan 2021 22:10:58 +0800 Subject: feat: Timeline info contains bookmark and highlight flag. --- .../IntegratedTests/BookmarkTimelineTest.cs | 38 ++++++++++++++++++++++ .../IntegratedTests/HighlightTimelineTest.cs | 33 +++++++++++++++++++ 2 files changed, 71 insertions(+) (limited to 'BackEnd/Timeline.Tests/IntegratedTests') diff --git a/BackEnd/Timeline.Tests/IntegratedTests/BookmarkTimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/BookmarkTimelineTest.cs index e6ae178f..99cf6d3a 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/BookmarkTimelineTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/BookmarkTimelineTest.cs @@ -83,5 +83,43 @@ namespace Timeline.Tests.IntegratedTests h.Should().BeEmpty(); } } + + [Fact] + public async Task TimelineGet_IsBookmarkField_ShouldWork() + { + using var client = await CreateClientAsUser(); + await client.TestPostAsync("timelines", new TimelineCreateRequest { Name = "t" }); + + { + var t = await client.TestGetAsync("timelines/t"); + t.IsBookmark.Should().BeFalse(); + } + + await client.TestPutAsync("bookmarks/t"); + + { + var t = await client.TestGetAsync("timelines/t"); + t.IsBookmark.Should().BeTrue(); + } + + { + var client1 = await CreateDefaultClient(); + var t = await client1.TestGetAsync("timelines/t"); + t.IsBookmark.Should().BeFalse(); + } + + { + var client1 = await CreateClientAsAdministrator(); + var t = await client1.TestGetAsync("timelines/t"); + t.IsBookmark.Should().BeFalse(); + } + + await client.TestDeleteAsync("bookmarks/t"); + + { + var t = await client.TestGetAsync("timelines/t"); + t.IsBookmark.Should().BeFalse(); + } + } } } diff --git a/BackEnd/Timeline.Tests/IntegratedTests/HighlightTimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/HighlightTimelineTest.cs index a3f2855e..440759f4 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/HighlightTimelineTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/HighlightTimelineTest.cs @@ -86,5 +86,38 @@ namespace Timeline.Tests.IntegratedTests h.Should().BeEmpty(); } } + + [Fact] + public async Task TimelineGet_IsHighlighField_Should_Work() + { + using var client = await CreateClientAsAdministrator(); + await client.TestPostAsync("timelines", new TimelineCreateRequest { Name = "t" }); + + { + var t = await client.TestGetAsync("timelines/t"); + t.IsHighlight.Should().BeFalse(); + } + + await client.TestPutAsync("highlights/t"); + + { + var t = await client.TestGetAsync("timelines/t"); + t.IsHighlight.Should().BeTrue(); + } + + { + var client1 = await CreateDefaultClient(); + var t = await client1.TestGetAsync("timelines/t"); + t.IsHighlight.Should().BeTrue(); + } + + await client.TestDeleteAsync("highlights/t"); + + { + var t = await client.TestGetAsync("timelines/t"); + t.IsHighlight.Should().BeFalse(); + } + + } } } -- cgit v1.2.3