From b84441ab879271de900099b4b23a2c2bc1099db7 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 4 Jun 2018 22:25:18 +0900 Subject: [PATCH] Fix TestImportOverIPC --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 586217a05f..645c76f265 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -264,7 +264,8 @@ namespace osu.Game.Tests.Beatmaps.IO private string createTemporaryBeatmap() { - var temp = new FileInfo(osz_path).CopyTo(Path.GetTempFileName(), true).FullName; + var temp = Path.GetTempFileName() + Guid.NewGuid() + ".osz"; + File.Copy(osz_path, temp, true); Assert.IsTrue(File.Exists(temp)); return temp; } @@ -344,12 +345,12 @@ namespace osu.Game.Tests.Beatmaps.IO private void waitForOrAssert(Func result, string failureMessage, int timeout = 60000) { - Action waitAction = () => + Task task = Task.Run(() => { while (!result()) Thread.Sleep(200); - }; + }); - Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), failureMessage); + Assert.IsTrue(task.Wait(timeout), failureMessage); } } }