aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-13 17:08:20 +0800
committercrupest <crupest@outlook.com>2020-11-13 17:08:20 +0800
commit48d53341db4953b3d583dd825b48d854c0a166e9 (patch)
tree6db1d56071e1fc27d3a21e6c6fb5d0342e2b17c4 /BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs
parent2a132acab30042f068577096f6b97f6961951b0e (diff)
downloadtimeline-48d53341db4953b3d583dd825b48d854c0a166e9.tar.gz
timeline-48d53341db4953b3d583dd825b48d854c0a166e9.tar.bz2
timeline-48d53341db4953b3d583dd825b48d854c0a166e9.zip
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs')
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests/TimelineTest.cs23
1 files changed, 9 insertions, 14 deletions
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<TimelineInfo> _testTimelines;
-
private async Task CreateTestTimelines()
{
- _testTimelines = new List<TimelineInfo>();
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<TimelineInfo>().Which;
- _testTimelines.Add(timelineInfo);
+ res.Should().HaveStatusCode(200);
}
}
- private static string CalculateUrlTail(string subpath, ICollection<KeyValuePair<string, string>> query)
+ private static string CalculateUrlTail(string? subpath, ICollection<KeyValuePair<string, string>>? 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<KeyValuePair<string, string>> query = null)
+ private static string GeneratePersonalTimelineUrl(int id, string? subpath = null, ICollection<KeyValuePair<string, string>>? query = null)
{
return $"timelines/@{(id == 0 ? "admin" : ("user" + id))}{CalculateUrlTail(subpath, query)}";
}
- private static string GenerateOrdinaryTimelineUrl(int id, string subpath = null, ICollection<KeyValuePair<string, string>> query = null)
+ private static string GenerateOrdinaryTimelineUrl(int id, string? subpath = null, ICollection<KeyValuePair<string, string>>? 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<TimelineInfo>().Which;
- body.Owner.Should().BeEquivalentTo(UserInfos[1]);
+ var body = await res.Should().HaveStatusCode(200)
+ .And.HaveAndGetJsonBodyAsync<TimelineInfo>();
+ body.Owner.Should().;
body.Visibility.Should().Be(TimelineVisibility.Register);
body.Description.Should().Be("");
body.Members.Should().NotBeNull().And.BeEmpty();