diff options
author | crupest <crupest@outlook.com> | 2020-06-14 16:34:42 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-14 16:34:42 +0800 |
commit | 5e02abc95cc8419b378917d7053d63092046b2cf (patch) | |
tree | ace855832f1c4e88e9fed7b2b2c95fb5e06424f3 /Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs | |
parent | 4c6f4c214edc5b574951d4cc8f3654bc30efa8da (diff) | |
download | timeline-5e02abc95cc8419b378917d7053d63092046b2cf.tar.gz timeline-5e02abc95cc8419b378917d7053d63092046b2cf.tar.bz2 timeline-5e02abc95cc8419b378917d7053d63092046b2cf.zip |
Many many bugs fix.
1. Add a way to test front end with mock page.
2. Unknown api returns 400 but not frontend page.
3. Fix a big bug that cause all data loss in database migration.
Diffstat (limited to 'Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs')
-rw-r--r-- | Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs b/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs new file mode 100644 index 00000000..40f818a7 --- /dev/null +++ b/Timeline.Tests/IntegratedTests/UnknownEndpointTest.cs @@ -0,0 +1,26 @@ +using FluentAssertions;
+using Microsoft.AspNetCore.Mvc.Testing;
+using System.Threading.Tasks;
+using Timeline.Models.Http;
+using Timeline.Tests.Helpers;
+using Xunit;
+
+namespace Timeline.Tests.IntegratedTests
+{
+ public class UnknownEndpointTest : IntegratedTestBase
+ {
+ public UnknownEndpointTest(WebApplicationFactory<Startup> factory) : base(factory)
+ {
+ }
+
+ [Fact]
+ public async Task UnknownEndpoint()
+ {
+ using var client = await CreateDefaultClient();
+ var res = await client.GetAsync("unknownEndpoint");
+ res.Should().HaveStatusCode(400)
+ .And.HaveCommonBody()
+ .Which.Code.Should().Be(ErrorCodes.Common.UnknownEndpoint);
+ }
+ }
+}
|