From 59c8c821deb9b6515a167c0181375a8474089d4d Mon Sep 17 00:00:00 2001 From: Vitalii Orazov Date: Sat, 30 Sep 2023 18:45:23 +0300 Subject: [PATCH] improve comm tests stability --- .../Services/ClientServerTests.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ShareClipbrd/ShareClipbrd.Core.Tests/Services/ClientServerTests.cs b/ShareClipbrd/ShareClipbrd.Core.Tests/Services/ClientServerTests.cs index a66d3cd..05796a9 100644 --- a/ShareClipbrd/ShareClipbrd.Core.Tests/Services/ClientServerTests.cs +++ b/ShareClipbrd/ShareClipbrd.Core.Tests/Services/ClientServerTests.cs @@ -62,8 +62,8 @@ public async Task Send_CommonData_Test() { clipboardData.Add("Text", new MemoryStream(System.Text.Encoding.Unicode.GetBytes("Text 0123456789"))); await client.SendData(clipboardData); - client.Stop(); await server.Stop(); + client.Stop(); dispatchServiceMock.Verify(x => x.ReceiveData(It.IsAny()), Times.Exactly(2)); Assert.IsNotNull(receivedClipboard); @@ -93,8 +93,8 @@ public async Task Send_Common_Big_Data_Test() { clipboardData.Add("Text", new MemoryStream(bytes)); await client.SendData(clipboardData); - client.Stop(); await server.Stop(); + client.Stop(); dispatchServiceMock.VerifyAll(); Assert.IsNotNull(receivedClipboard); @@ -143,8 +143,8 @@ public async Task Send_Files_Test() { } finally { Directory.Delete(testsPath, true); - client.Stop(); await server.Stop(); + client.Stop(); } dispatchServiceMock.Verify(x => x.ReceiveFiles(It.IsAny>()), Times.Exactly(3)); @@ -199,8 +199,8 @@ public async Task Send_Big_File_Test() { await client.SendFileDropList(files); } finally { Directory.Delete(testsPath, true); - client.Stop(); await server.Stop(); + client.Stop(); } dispatchServiceMock.VerifyAll(); @@ -271,8 +271,8 @@ public async Task Send_Files_And_Folders_Test() { await client.SendFileDropList(files); } finally { Directory.Delete(testsPath, true); - client.Stop(); await server.Stop(); + client.Stop(); } dispatchServiceMock.VerifyAll(); @@ -355,8 +355,8 @@ public async Task Send_identical_Files__Test() { await client.SendFileDropList(files); } finally { Directory.Delete(testsPath, true); - client.Stop(); await server.Stop(); + client.Stop(); } dispatchServiceMock.VerifyAll(); @@ -411,7 +411,6 @@ public async Task DataClient_Ping_Periodic_Test() { }); server.Start(); - await Task.Delay(1000); client.Start(); await AwaitClientConnectStatus(true); @@ -424,8 +423,8 @@ public async Task DataClient_Ping_Periodic_Test() { connectStatusServiceMock.Verify(x => x.ClientOffline(), Times.Once()); connectStatusServiceMock.Verify(x => x.ClientOnline(), Times.AtLeast(3)); - client.Stop(); await server.Stop(); + client.Stop(); } } }