Move UserLookupCache inside dependencies

This commit is contained in:
smoogipoo
2021-06-25 17:37:02 +09:00
parent d6ab08c958
commit 7aefbe3da1
11 changed files with 46 additions and 69 deletions

View File

@ -3,21 +3,17 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Online.Spectator;
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps.IO;
using osu.Game.Tests.Visual.OnlinePlay;
using osu.Game.Tests.Visual.Spectator;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Multiplayer
{
@ -289,24 +285,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
protected class TestDependencies : MultiplayerRoomTestDependencies
{
public readonly TestSpectatorClient SpectatorClient = new TestSpectatorClient();
public readonly UserLookupCache LookupCache = new TestUserLookupCache();
public TestDependencies()
{
CacheAs<SpectatorClient>(SpectatorClient);
CacheAs(LookupCache);
}
}
internal class TestUserLookupCache : UserLookupCache
{
protected override Task<User> ComputeValueAsync(int lookup, CancellationToken token = default)
{
return Task.FromResult(new User
{
Id = lookup,
Username = $"User {lookup}"
});
}
}
}