From f223683c35bf22bae736621ee77d3ec543a36b01 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 8 Apr 2022 17:43:24 +0800 Subject: ... --- .../IntegratedTests2/TimelineTest.cs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs') 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(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.Created); + + await client.TestJsonSendAsync(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "hello" + }, expectedStatusCode: HttpStatusCode.UnprocessableEntity); + } + + [Fact] + public async Task CreateInvalid() + { + using var client = CreateClientAsUser(); + await client.TestJsonSendAsync(HttpMethod.Post, "v2/timelines", new HttpTimelineCreateRequest + { + Name = "!!!" + }, expectedStatusCode: HttpStatusCode.UnprocessableEntity); + } } } -- cgit v1.2.3