From f8c73d52e29a5d72336d0e729c71e46ad4795238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Mon, 15 May 2023 14:52:33 +0200 Subject: [PATCH] Fix some nullability warnings in tests --- .../SocketClientTests.cs | 8 ++++---- .../SocketServerTests.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketClientTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketClientTests.cs index 2461db6029..91b2e826f4 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketClientTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketClientTests.cs @@ -83,7 +83,7 @@ public void SocketClientStartShouldThrowIfServerIsNotListening() [TestMethod] public void SocketClientStopShouldRaiseClientDisconnectedEventOnClientDisconnection() { - var waitEvent = SetupClientDisconnect(out ICommunicationChannel _); + var waitEvent = SetupClientDisconnect(out ICommunicationChannel? _); // Close the communication from client side _socketClient.Stop(); @@ -94,7 +94,7 @@ public void SocketClientStopShouldRaiseClientDisconnectedEventOnClientDisconnect [TestMethod] public void SocketClientShouldRaiseClientDisconnectedEventIfConnectionIsBroken() { - var waitEvent = SetupClientDisconnect(out ICommunicationChannel _); + var waitEvent = SetupClientDisconnect(out ICommunicationChannel? _); // Close the communication from server side _tcpClient?.GetStream().Dispose(); @@ -106,7 +106,7 @@ public void SocketClientShouldRaiseClientDisconnectedEventIfConnectionIsBroken() [TestMethod] public void SocketClientStopShouldStopCommunication() { - var waitEvent = SetupClientDisconnect(out ICommunicationChannel _); + var waitEvent = SetupClientDisconnect(out ICommunicationChannel? _); // Close the communication from socket client side _socketClient.Stop(); @@ -157,7 +157,7 @@ private ManualResetEvent SetupClientDisconnect(out ICommunicationChannel? channe { var waitEvent = new ManualResetEvent(false); _socketClient.Disconnected += (s, e) => waitEvent.Set(); - channel = SetupChannel(out ConnectedEventArgs _); + channel = SetupChannel(out ConnectedEventArgs? _); channel!.MessageReceived += (sender, args) => { }; diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketServerTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketServerTests.cs index ac1b866a77..b64a9e4304 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketServerTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.Platform.UnitTests/SocketServerTests.cs @@ -140,7 +140,7 @@ public void SocketServerShouldRaiseClientDisconnectedEventIfConnectionIsBroken() [TestMethod] public async Task SocketEndpointShouldInitializeChannelOnServerConnection() { - var channel = SetupChannel(out ConnectedEventArgs _); + var channel = SetupChannel(out ConnectedEventArgs? _); await channel!.Send(Dummydata);