Fix multiple tests via null checks and changing ToLive to Detach

flow
This commit is contained in:
Dean Herbert
2022-01-08 00:40:14 +09:00
parent 13401a8846
commit e74a5022c9
11 changed files with 31 additions and 19 deletions

View File

@ -409,18 +409,18 @@ namespace osu.Game.Tests.Visual.Multiplayer
public override Task<APIBeatmap> GetAPIBeatmap(int beatmapId, CancellationToken cancellationToken = default)
{
IBeatmapSetInfo? set = roomManager.ServerSideRooms.SelectMany(r => r.Playlist)
.FirstOrDefault(p => p.BeatmapID == beatmapId)?.Beatmap.Value.BeatmapSet
?? beatmaps.QueryBeatmap(b => b.OnlineID == beatmapId)?.BeatmapSet;
IBeatmapInfo? beatmap = roomManager.ServerSideRooms.SelectMany(r => r.Playlist)
.FirstOrDefault(p => p.BeatmapID == beatmapId)?.Beatmap.Value
?? beatmaps.QueryBeatmap(b => b.OnlineID == beatmapId);
if (set == null)
if (beatmap == null)
throw new InvalidOperationException("Beatmap not found.");
return Task.FromResult(new APIBeatmap
{
BeatmapSet = new APIBeatmapSet { OnlineID = set.OnlineID },
BeatmapSet = new APIBeatmapSet { OnlineID = beatmap.BeatmapSet?.OnlineID ?? -1 },
OnlineID = beatmapId,
Checksum = set.Beatmaps.First(b => b.OnlineID == beatmapId).MD5Hash
Checksum = beatmap.MD5Hash
});
}