From c4b1460f001c781e5536fb929ff8a496c9bd95a7 Mon Sep 17 00:00:00 2001 From: Alan McGovern Date: Tue, 26 May 2020 00:24:55 +0100 Subject: [PATCH] [tests] Use an async wait instead of Thread.Sleep --- .../MonoTorrent.Client.Modes/MetadataModeTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/MonoTorrent.Tests/MonoTorrent.Client.Modes/MetadataModeTests.cs b/src/MonoTorrent.Tests/MonoTorrent.Client.Modes/MetadataModeTests.cs index 4498eb50d..570883b0b 100644 --- a/src/MonoTorrent.Tests/MonoTorrent.Client.Modes/MetadataModeTests.cs +++ b/src/MonoTorrent.Tests/MonoTorrent.Client.Modes/MetadataModeTests.cs @@ -246,8 +246,7 @@ internal async Task SendMetadataCore (string expectedPath, PeerMessage sendAfter } // We've sent all the pieces. Now we just wait for the torrentmanager to process them all. - while (rig.Manager.Mode is MetadataMode) - System.Threading.Thread.Sleep (10); + await rig.Manager.WaitForState (TorrentState.Downloading).WithTimeout (); Assert.IsTrue (File.Exists (expectedPath), "#1"); Torrent torrent = Torrent.Load (expectedPath);