aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-04-08 17:43:24 +0800
committercrupest <crupest@outlook.com>2022-04-08 17:43:24 +0800
commitf223683c35bf22bae736621ee77d3ec543a36b01 (patch)
tree08444657f2d36b02fe0c67eb810eb53bd1c5af14 /BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
parent27e1360ffe4b2f5aa7d240e1de88c5459587b489 (diff)
downloadtimeline-f223683c35bf22bae736621ee77d3ec543a36b01.tar.gz
timeline-f223683c35bf22bae736621ee77d3ec543a36b01.tar.bz2
timeline-f223683c35bf22bae736621ee77d3ec543a36b01.zip
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs')
-rw-r--r--BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
index 19ad315e..73ab35f2 100644
--- a/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
+++ b/BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs
@@ -29,6 +29,31 @@ namespace Timeline.Tests.IntegratedTests2
a.Name.Should().Be(b.Name);
a.UniqueId.Should().Be(b.UniqueId);
}
+
+ [Fact]
+ public async Task CreateSameName()
+ {
+ using var client = CreateClientAsUser();
+ await client.TestJsonSendAsync<HttpTimeline>(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest
+ {
+ Name = "hello"
+ }, expectedStatusCode: HttpStatusCode.Created);
+
+ await client.TestJsonSendAsync<HttpTimeline>(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest
+ {
+ Name = "hello"
+ }, expectedStatusCode: HttpStatusCode.UnprocessableEntity);
+ }
+
+ [Fact]
+ public async Task CreateInvalid()
+ {
+ using var client = CreateClientAsUser();
+ await client.TestJsonSendAsync<HttpTimeline>(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest
+ {
+ Name = "!!!"
+ }, expectedStatusCode: HttpStatusCode.UnprocessableEntity);
+ }
}
}