// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Threading; using System.Threading.Tasks; using osu.Game.Database; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tests.Visual { public partial class TestUserLookupCache : UserLookupCache { /// /// A special user ID which would return a for. /// As a simulation to what a regular would return in the case of failing to fetch the user. /// public const int UNRESOLVED_USER_ID = -1; protected override Task ComputeValueAsync(int lookup, CancellationToken token = default) { if (lookup == UNRESOLVED_USER_ID) return Task.FromResult(null); return Task.FromResult(new APIUser { Id = lookup, Username = $"User {lookup}" }); } } }