1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +08:00

Update tests

This commit is contained in:
Mikal Stodal 2017-02-28 14:36:11 +01:00
parent d54a75a5c5
commit 7e72911d3a

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -40,8 +41,16 @@ namespace osu.Game.Tests.Beatmaps.IO
using (HeadlessGameHost host = new HeadlessGameHost())
{
var osu = loadOsu(host);
osu.Dependencies.Get<BeatmapDatabase>().Import(osz_path);
var temp = prepareTempCopy(osz_path);
Assert.IsTrue(File.Exists(temp));
osu.Dependencies.Get<BeatmapDatabase>().Import(temp);
ensureLoaded(osu);
Assert.IsFalse(File.Exists(temp));
}
}
@ -56,14 +65,26 @@ namespace osu.Game.Tests.Beatmaps.IO
var osu = loadOsu(host);
var temp = prepareTempCopy(osz_path);
Assert.IsTrue(File.Exists(temp));
var importer = new BeatmapImporter(client);
if (!importer.ImportAsync(osz_path).Wait(1000))
if (!importer.ImportAsync(temp).Wait(1000))
Assert.Fail(@"IPC took too long to send");
ensureLoaded(osu);
Assert.IsFalse(File.Exists(temp));
}
}
private string prepareTempCopy(string path)
{
var temp = Path.GetTempFileName();
return new FileInfo(osz_path).CopyTo(temp, true).FullName;
}
private OsuGameBase loadOsu(GameHost host)
{
var osu = new OsuGameBase();