diff --git a/src/Websocket.Client/Threading/WebsocketAsyncLock.cs b/src/Websocket.Client/Threading/WebsocketAsyncLock.cs index c3e6b80..e443909 100644 --- a/src/Websocket.Client/Threading/WebsocketAsyncLock.cs +++ b/src/Websocket.Client/Threading/WebsocketAsyncLock.cs @@ -49,7 +49,7 @@ public Task LockAsync() return waitTask.IsCompleted ? _releaserTask : waitTask.ContinueWith( - (_, releaser) => (IDisposable)releaser, + (_, releaser) => (IDisposable)releaser!, _releaser, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, diff --git a/src/Websocket.Client/Websocket.Client.csproj b/src/Websocket.Client/Websocket.Client.csproj index f244c87..3d39e4d 100644 --- a/src/Websocket.Client/Websocket.Client.csproj +++ b/src/Websocket.Client/Websocket.Client.csproj @@ -35,6 +35,7 @@ + diff --git a/src/Websocket.Client/icon-modern.jpg b/src/Websocket.Client/icon-modern.jpg deleted file mode 100644 index e9b8f8e..0000000 Binary files a/src/Websocket.Client/icon-modern.jpg and /dev/null differ diff --git a/src/Websocket.Client/icon-modern.png b/src/Websocket.Client/icon-modern.png new file mode 100644 index 0000000..d33b42b Binary files /dev/null and b/src/Websocket.Client/icon-modern.png differ diff --git a/test/Websocket.Client.Tests/Testserver/TestContext.cs b/test/Websocket.Client.Tests/Testserver/TestContext.cs index 8a43689..e689809 100644 --- a/test/Websocket.Client.Tests/Testserver/TestContext.cs +++ b/test/Websocket.Client.Tests/Testserver/TestContext.cs @@ -1,7 +1,9 @@ using System; using Microsoft.AspNetCore.TestHost; +using Microsoft.Extensions.Logging; using Serilog; using Serilog.Events; +using Serilog.Extensions.Logging; using Xunit.Abstractions; namespace Websocket.Client.Tests.TestServer @@ -9,11 +11,14 @@ namespace Websocket.Client.Tests.TestServer public class TestContext where TStartup : class { private readonly TestServerApplicationFactory _factory; + private readonly ILogger _logger; public TestContext(ITestOutputHelper output) { _factory = new TestServerApplicationFactory(); - InitLogging(output); + var factory = InitLogging(output); + if (factory != null) + _logger = factory.CreateLogger(); } public WebSocketClient NativeTestClient { get; set; } @@ -33,7 +38,7 @@ public IWebsocketClient CreateClient(Uri serverUrl) Scheme = "ws", Path = "ws" }.Uri; - return new WebsocketClient(wsUri, + return new WebsocketClient(wsUri, _logger, async (uri, token) => { if (_factory.Server == null) @@ -60,19 +65,21 @@ public IWebsocketClient CreateInvalidClient(Uri serverUrl) Scheme = "ws", Path = "ws" }.Uri; - return new WebsocketClient(wsUri, + return new WebsocketClient(wsUri, _logger, (uri, token) => throw new InvalidOperationException("Connection to websocket server failed, check url")); } - private void InitLogging(ITestOutputHelper output) + private SerilogLoggerFactory InitLogging(ITestOutputHelper output) { if (output == null) - return; + return null; - Log.Logger = new LoggerConfiguration() + var logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.TestOutput(output, LogEventLevel.Verbose) .CreateLogger(); + Log.Logger = logger; + return new SerilogLoggerFactory(logger); } } } diff --git a/test/Websocket.Client.Tests/Websocket.Client.Tests.csproj b/test/Websocket.Client.Tests/Websocket.Client.Tests.csproj index 58fab6f..06a21d4 100644 --- a/test/Websocket.Client.Tests/Websocket.Client.Tests.csproj +++ b/test/Websocket.Client.Tests/Websocket.Client.Tests.csproj @@ -9,6 +9,7 @@ + all