diff options
author | crupest <crupest@outlook.com> | 2022-04-08 17:43:24 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-08 17:43:24 +0800 |
commit | f223683c35bf22bae736621ee77d3ec543a36b01 (patch) | |
tree | 08444657f2d36b02fe0c67eb810eb53bd1c5af14 /BackEnd/Timeline.Tests/IntegratedTests2 | |
parent | 27e1360ffe4b2f5aa7d240e1de88c5459587b489 (diff) | |
download | timeline-f223683c35bf22bae736621ee77d3ec543a36b01.tar.gz timeline-f223683c35bf22bae736621ee77d3ec543a36b01.tar.bz2 timeline-f223683c35bf22bae736621ee77d3ec543a36b01.zip |
...
Diffstat (limited to 'BackEnd/Timeline.Tests/IntegratedTests2')
-rw-r--r-- | BackEnd/Timeline.Tests/IntegratedTests2/TimelineTest.cs | 25 |
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); + } } } |