mirror of
https://github.com/ppy/osu.git
synced 2025-03-15 15:27:20 +08:00
Add test coverage of spectator requests
This commit is contained in:
parent
6a61fd95eb
commit
09d560c93e
@ -84,6 +84,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[SetUpSteps]
|
||||
public virtual void SetUpSteps()
|
||||
{
|
||||
AddStep("reset counts", () => spectatorClient.Invocations.Clear());
|
||||
|
||||
AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser
|
||||
{
|
||||
Id = 1,
|
||||
@ -111,6 +113,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
});
|
||||
|
||||
AddUntilStep("wait for load", () => Leaderboard.IsLoaded);
|
||||
|
||||
AddStep("check watch requests were sent", () =>
|
||||
{
|
||||
foreach (var user in MultiplayerUsers)
|
||||
spectatorClient.Verify(s => s.WatchUser(user.UserID), Times.Once);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -131,6 +139,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
MultiplayerUsers.RemoveAt(0);
|
||||
return false;
|
||||
});
|
||||
|
||||
AddStep("check stop watching requests were sent", () =>
|
||||
{
|
||||
foreach (var user in MultiplayerUsers)
|
||||
spectatorClient.Verify(s => s.StopWatchingUser(user.UserID), Times.Once);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -221,7 +221,7 @@ namespace osu.Game.Online.Spectator
|
||||
});
|
||||
}
|
||||
|
||||
public void WatchUser(int userId)
|
||||
public virtual void WatchUser(int userId)
|
||||
{
|
||||
Debug.Assert(ThreadSafety.IsUpdateThread);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user