From 48d53341db4953b3d583dd825b48d854c0a166e9 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 13 Nov 2020 17:08:20 +0800 Subject: ... --- .../Timeline.Tests/IntegratedTests/TimelineTest.cs | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs') diff --git a/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs index ec46b96a..fd574a82 100644 --- a/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs +++ b/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs @@ -55,22 +55,17 @@ namespace Timeline.Tests.IntegratedTests await CreateTestTimelines(); } - private List _testTimelines; - private async Task CreateTestTimelines() { - _testTimelines = new List(); for (int i = 0; i <= 3; i++) { var client = await CreateClientAs(i); var res = await client.PostAsJsonAsync("timelines", new TimelineCreateRequest { Name = $"t{i}" }); - var timelineInfo = res.Should().HaveStatusCode(200) - .And.HaveJsonBody().Which; - _testTimelines.Add(timelineInfo); + res.Should().HaveStatusCode(200); } } - private static string CalculateUrlTail(string subpath, ICollection> query) + private static string CalculateUrlTail(string? subpath, ICollection>? query) { StringBuilder result = new StringBuilder(); if (subpath != null) @@ -96,12 +91,12 @@ namespace Timeline.Tests.IntegratedTests return result.ToString(); } - private static string GeneratePersonalTimelineUrl(int id, string subpath = null, ICollection> query = null) + private static string GeneratePersonalTimelineUrl(int id, string? subpath = null, ICollection>? query = null) { return $"timelines/@{(id == 0 ? "admin" : ("user" + id))}{CalculateUrlTail(subpath, query)}"; } - private static string GenerateOrdinaryTimelineUrl(int id, string subpath = null, ICollection> query = null) + private static string GenerateOrdinaryTimelineUrl(int id, string? subpath = null, ICollection>? query = null) { return $"timelines/t{id}{CalculateUrlTail(subpath, query)}"; } @@ -114,12 +109,12 @@ namespace Timeline.Tests.IntegratedTests yield return new[] { new TimelineUrlGenerator(GenerateOrdinaryTimelineUrl) }; } - private static string GeneratePersonalTimelineUrlByName(string name, string subpath = null) + private static string GeneratePersonalTimelineUrlByName(string name, string? subpath = null) { return $"timelines/@{name}{(subpath == null ? "" : "/" + subpath)}"; } - private static string GenerateOrdinaryTimelineUrlByName(string name, string subpath = null) + private static string GenerateOrdinaryTimelineUrlByName(string name, string? subpath = null) { return $"timelines/{name}{(subpath == null ? "" : "/" + subpath)}"; } @@ -136,9 +131,9 @@ namespace Timeline.Tests.IntegratedTests using var client = await CreateDefaultClient(); { var res = await client.GetAsync("timelines/@user1"); - var body = res.Should().HaveStatusCode(200) - .And.HaveJsonBody().Which; - body.Owner.Should().BeEquivalentTo(UserInfos[1]); + var body = await res.Should().HaveStatusCode(200) + .And.HaveAndGetJsonBodyAsync(); + body.Owner.Should().; body.Visibility.Should().Be(TimelineVisibility.Register); body.Description.Should().Be(""); body.Members.Should().NotBeNull().And.BeEmpty(); -- cgit v1.2.3