Skip to content

Commit 7ba7dc6

Browse files
committed
Update PiperTest.cs
1 parent 279d781 commit 7ba7dc6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/DiffEngineTray.Tests/PiperTest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public async Task Delete()
4949
var task = PiperServer.Start(_ => { }, s => received = s, source.Token);
5050
await PiperClient.SendDeleteAsync("Foo", source.Token);
5151
await Task.Delay(1000, source.Token);
52-
source.Cancel();
52+
await source.CancelAsync();
5353
await task;
5454
await Verify(received);
5555
}
@@ -62,7 +62,7 @@ public async Task Move()
6262
var task = PiperServer.Start(s => received = s, _ => { }, source.Token);
6363
await PiperClient.SendMoveAsync("Foo", "Bar", "theExe", "TheArguments \"s\"", true, 10, source.Token);
6464
await Task.Delay(1000, source.Token);
65-
source.Cancel();
65+
await source.CancelAsync();
6666
await task;
6767
await Verify(received);
6868
}
@@ -78,18 +78,18 @@ public async Task ClientDisconnectsAbruptly()
7878
// simulating a client that was canceled mid-connection.
7979
using (var client = new TcpClient())
8080
{
81-
await client.ConnectAsync(IPAddress.Loopback, PiperClient.Port);
81+
await client.ConnectAsync(IPAddress.Loopback, PiperClient.Port, source.Token);
8282
// Linger with timeout 0 causes a RST (forcible close) on Close
8383
client.LingerState = new(true, 0);
8484
}
8585

8686
// Give the server time to process the abrupt disconnect
87-
await Task.Delay(500);
87+
await Task.Delay(500, source.Token);
8888

8989
// Server should still work after the abrupt disconnect
9090
await PiperClient.SendDeleteAsync("Foo", source.Token);
9191
await Task.Delay(1000, source.Token);
92-
source.Cancel();
92+
await source.CancelAsync();
9393
await task;
9494

9595
// Verify the server recovered and processed the subsequent valid message

0 commit comments

Comments
 (0)