diff --git a/src/EmbedIO/EmbedIO.csproj b/src/EmbedIO/EmbedIO.csproj index ed1751a72..dff1d7a5a 100644 --- a/src/EmbedIO/EmbedIO.csproj +++ b/src/EmbedIO/EmbedIO.csproj @@ -2,7 +2,7 @@ A tiny, cross-platform, module based, MIT-licensed web server. Supporting NET Framework, Net Core, and Mono. - Copyright © Unosquare 2013-2019 + Copyright © Unosquare 2013-2020 EmbedIO Web Server Unosquare, and Contributors to EmbedIO netstandard2.0 @@ -10,7 +10,7 @@ EmbedIO EmbedIO ..\..\StyleCop.Analyzers.ruleset - 3.1.3 + 3.3.0 EmbedIO Unosquare LICENSE diff --git a/test/EmbedIO.Tests/IPBanningModuleTest.cs b/test/EmbedIO.Tests/IPBanningModuleTest.cs index 4e2b5cd31..89b4c8d57 100644 --- a/test/EmbedIO.Tests/IPBanningModuleTest.cs +++ b/test/EmbedIO.Tests/IPBanningModuleTest.cs @@ -30,12 +30,12 @@ protected override void OnSetUp() private HttpRequestMessage GetUnauthorizedRequest() => new HttpRequestMessage(HttpMethod.Get, $"{WebServerUrl}/api/unauthorized"); - private IPAddress LocalHost { get; } = IPAddress.Parse("127.0.0.1"); + private IPAddress Localhost { get; } = IPAddress.Parse("127.0.0.1"); [Test] public async Task RequestFailRegex_ReturnsForbidden() { - IPBanningModule.TryUnbanIP(LocalHost); + IPBanningModule.TryUnbanIP(Localhost); _ = await Client.SendAsync(GetNotFoundRequest()); _ = await Client.SendAsync(GetUnauthorizedRequest()); @@ -51,12 +51,12 @@ public async Task RequestFailRegex_ReturnsForbidden() [Test] public async Task BanIpMinutes_ReturnsForbidden() { - IPBanningModule.TryUnbanIP(LocalHost); + IPBanningModule.TryUnbanIP(Localhost); var response = await Client.SendAsync(GetNotFoundRequest()); Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode, "Status Code NotFound"); - IPBanningModule.TryBanIP(LocalHost, 10); + IPBanningModule.TryBanIP(Localhost, 10); response = await Client.SendAsync(GetNotFoundRequest()); Assert.AreEqual(HttpStatusCode.Forbidden, response.StatusCode, "Status Code Forbidden"); @@ -65,12 +65,12 @@ public async Task BanIpMinutes_ReturnsForbidden() [Test] public async Task BanIpTimeSpan_ReturnsForbidden() { - IPBanningModule.TryUnbanIP(LocalHost); + IPBanningModule.TryUnbanIP(Localhost); var response = await Client.SendAsync(GetNotFoundRequest()); Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode, "Status Code NotFound"); - IPBanningModule.TryBanIP(LocalHost, TimeSpan.FromMinutes(10)); + IPBanningModule.TryBanIP(Localhost, TimeSpan.FromMinutes(10)); response = await Client.SendAsync(GetNotFoundRequest()); Assert.AreEqual(HttpStatusCode.Forbidden, response.StatusCode, "Status Code Forbidden"); @@ -79,12 +79,12 @@ public async Task BanIpTimeSpan_ReturnsForbidden() [Test] public async Task BanIpDateTime_ReturnsForbidden() { - IPBanningModule.TryUnbanIP(LocalHost); + IPBanningModule.TryUnbanIP(Localhost); var response = await Client.SendAsync(GetNotFoundRequest()); Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode, "Status Code NotFound"); - IPBanningModule.TryBanIP(LocalHost, DateTime.Now.AddMinutes(10)); + IPBanningModule.TryBanIP(Localhost, DateTime.Now.AddMinutes(10)); response = await Client.SendAsync(GetNotFoundRequest()); Assert.AreEqual(HttpStatusCode.Forbidden, response.StatusCode, "Status Code Forbidden"); @@ -93,7 +93,7 @@ public async Task BanIpDateTime_ReturnsForbidden() [Test] public async Task RequestFailRegex_UnbanIp_ReturnsNotFound() { - IPBanningModule.TryUnbanIP(LocalHost); + IPBanningModule.TryUnbanIP(Localhost); _ = await Client.SendAsync(GetNotFoundRequest()); _ = await Client.SendAsync(GetNotFoundRequest()); @@ -117,7 +117,7 @@ public async Task RequestFailRegex_UnbanIp_ReturnsNotFound() [Test] public async Task MaxRps_ReturnsForbidden() { - IPBanningModule.TryUnbanIP(LocalHost); + IPBanningModule.TryUnbanIP(Localhost); foreach (var _ in Enumerable.Range(0, 100)) { diff --git a/test/EmbedIO.Tests/TestObjects/TestController.cs b/test/EmbedIO.Tests/TestObjects/TestController.cs index 212248c21..7932036fa 100644 --- a/test/EmbedIO.Tests/TestObjects/TestController.cs +++ b/test/EmbedIO.Tests/TestObjects/TestController.cs @@ -72,7 +72,7 @@ public Person GetOptionalPerson(string skill, int? age = null) throw HttpException.Unauthorized(); private static Person CheckPerson(int id) - =>PeopleRepository.Database.FirstOrDefault(p => p.Key == id) + => PeopleRepository.Database.FirstOrDefault(p => p.Key == id) ?? throw HttpException.NotFound(); } } \ No newline at end of file