Access database recursively.

This commit is contained in:
Huo Yaoyuan
2017-05-06 15:37:53 +08:00
parent 146d57953d
commit 767cfaaac3
6 changed files with 23 additions and 35 deletions

View File

@ -118,7 +118,7 @@ namespace osu.Game.Tests.Beatmaps.IO
Action waitAction = () =>
{
while (!(resultSets = host.Dependencies.Get<BeatmapDatabase>()
.Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Any())
.GetAllWithChildren<BeatmapSetInfo>(s => s.OnlineBeatmapSetID == 241526)).Any())
Thread.Sleep(50);
};
@ -135,15 +135,14 @@ namespace osu.Game.Tests.Beatmaps.IO
waitAction = () =>
{
while ((resultBeatmaps = host.Dependencies.Get<BeatmapDatabase>()
.Query<BeatmapInfo>().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
.GetAllWithChildren<BeatmapInfo>(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12)
Thread.Sleep(50);
};
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
@"Beatmaps did not import to the database in allocated time");
//fetch children and check we can load from the post-storage path...
var set = host.Dependencies.Get<BeatmapDatabase>().GetChildren(resultSets.First());
var set = resultSets.First();
Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(),
$@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).");