diff --git a/dotAPNS.AspNetCore/dotAPNS.AspNetCore.csproj b/dotAPNS.AspNetCore/dotAPNS.AspNetCore.csproj index 8c5b8d1..0f4f91e 100644 --- a/dotAPNS.AspNetCore/dotAPNS.AspNetCore.csproj +++ b/dotAPNS.AspNetCore/dotAPNS.AspNetCore.csproj @@ -16,7 +16,7 @@ - + diff --git a/dotAPNS.Tests/ApnsClient_Tests.cs b/dotAPNS.Tests/ApnsClient_Tests.cs index 8372820..a28a16a 100644 --- a/dotAPNS.Tests/ApnsClient_Tests.cs +++ b/dotAPNS.Tests/ApnsClient_Tests.cs @@ -1,23 +1,18 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Drawing; using System.IO; using System.Linq; -using System.Linq.Expressions; using System.Net; using System.Net.Http; using System.Runtime.InteropServices; using System.Security.Authentication; -using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; using ExpectedObjects; using JetBrains.Annotations; using Moq; using Moq.Protected; -using Newtonsoft.Json.Bson; using Nito.AsyncEx; using Xunit; @@ -46,9 +41,9 @@ public void Sending_NonVoip_Type_With_Voip_Cert_Fails() } [Fact] - public void Creating_Client_With_Cert_Not_Fails_Only_On_NetCore3_0() + public void Creating_Client_With_Cert_Fails_Only_On_Net6() { -#if !NETCOREAPP3_1 +#if NET46 Assert.Throws(() => ApnsClient.CreateUsingCert(_certs.P12Cert)); #else ApnsClient.CreateUsingCert(_certs.P12Cert); @@ -177,9 +172,9 @@ public async Task SendAsync_Uses_Correct_Port(bool useBackupPort, bool useSandbo [Theory] [InlineData(false, false, ApnsClient.ProductionEndpoint)] [InlineData(false, true, ApnsClient.DevelopmentEndpoint)] - [InlineData(true, false, ApnsClient.DevelopmentEndpoint)] + [InlineData(true, false, ApnsClient.DevelopmentEndpoint)] [InlineData(true, true, ApnsClient.DevelopmentEndpoint)] - public async Task SendAsync_Should_Use_Correct_Environment_Server(bool isClientDevelopment, bool isPushDevelopment, + public async Task SendAsync_Should_Use_Correct_Environment_Server(bool isClientDevelopment, bool isPushDevelopment, string expectedUrl) { var (apns, httpHandlerMock) = BoostrapApnsClient(); @@ -207,7 +202,7 @@ public async Task SendAsync_Should_Use_Correct_Environment_Server(bool isClientD [Fact] public Task SendAsync_Throws_When_Canceled() { - var (apns, httpHandlerMock) = BoostrapApnsClient(delay:TimeSpan.FromSeconds(10)); + var (apns, httpHandlerMock) = BoostrapApnsClient(delay: TimeSpan.FromSeconds(10)); var push = CreateStubPush(); return Assert.ThrowsAsync(async () => { @@ -262,7 +257,7 @@ public async Task Ensure_SendAsync_Throws_On_Expired_Certificate_On_Windows() // Arrange var ex = new HttpRequestException(null, new AuthenticationException(null, - new Win32Exception(- 2146893016))); + new Win32Exception(-2146893016))); var (apns, httpHandlerMock) = BoostrapApnsClient(throwOnResponse: ex); var push = CreateStubPush(); @@ -303,9 +298,9 @@ public async Task Ensure_SendAsync_Throws_On_Expired_Certificate_On_Linux() } }; - (ApnsClient apns, Mock httpHandlerMock) BoostrapApnsClient(int statusCode = 200, string responseContent = "{}", TimeSpan delay=default, [CanBeNull] Exception throwOnResponse = null) + (ApnsClient apns, Mock httpHandlerMock) BoostrapApnsClient(int statusCode = 200, string responseContent = "{}", TimeSpan delay = default, [CanBeNull] Exception throwOnResponse = null) { - if(delay==default) delay = TimeSpan.FromMilliseconds(1); + if (delay == default) delay = TimeSpan.FromMilliseconds(1); var httpHandler = new Mock(MockBehavior.Strict); var sendAsyncSetup = httpHandler.Protected() .Setup>( @@ -325,12 +320,12 @@ public async Task Ensure_SendAsync_Throws_On_Expired_Certificate_On_Linux() await Task.Delay(delay, c).ConfigureAwait(false); // technically library-side code, thus ignoring sync ctx return new HttpResponseMessage() { - StatusCode = (HttpStatusCode) statusCode, + StatusCode = (HttpStatusCode)statusCode, Content = new JsonContent(responseContent) }; }); } - + var jwt = CreateStubJwt(); var client = ApnsClient.CreateUsingJwt(new HttpClient(httpHandler.Object), jwt); return (client, httpHandler); diff --git a/dotAPNS.Tests/dotAPNS.Tests.csproj b/dotAPNS.Tests/dotAPNS.Tests.csproj index b512abc..90d1588 100644 --- a/dotAPNS.Tests/dotAPNS.Tests.csproj +++ b/dotAPNS.Tests/dotAPNS.Tests.csproj @@ -1,46 +1,46 @@ - - net46;netcoreapp2.1;netcoreapp3.1 - false - + + net46;netcoreapp3.1;net6.0 + false + - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - - - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + - - - - - - - - - - - - - Always - - + + + Always + + \ No newline at end of file diff --git a/dotAPNS/dotAPNS.csproj b/dotAPNS/dotAPNS.csproj index a6d5b1c..c4ab4f8 100644 --- a/dotAPNS/dotAPNS.csproj +++ b/dotAPNS/dotAPNS.csproj @@ -19,19 +19,19 @@ - + - + NU1701 - +