1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Move login to it's own function

This commit is contained in:
Andrei Zavatski 2019-11-06 18:32:09 +03:00
parent 8395df596b
commit 59aa9b59d6

View File

@ -7,8 +7,6 @@ using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Overlays.Comments;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Users;
using osu.Framework.MathUtils;
namespace osu.Game.Tests.Visual.Online
{
@ -25,10 +23,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestUserCommentPill()
{
AddStep("Log in", () => API.LocalUser.Value = new User
{
Id = RNG.Next(2, 100000)
});
AddStep("Log in", logIn);
AddStep("User comment", () => addVotePill(getUserComment()));
AddStep("Click", () => votePill.Click());
AddAssert("Not loading", () => !votePill.IsLoading);
@ -37,10 +32,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestRandomCommentPill()
{
AddStep("Log in", () => API.LocalUser.Value = new User
{
Id = RNG.Next(2, 100000)
});
AddStep("Log in", logIn);
AddStep("Random comment", () => addVotePill(getRandomComment()));
AddStep("Click", () => votePill.Click());
AddAssert("Loading", () => votePill.IsLoading);
@ -55,6 +47,8 @@ namespace osu.Game.Tests.Visual.Online
AddAssert("Not loading", () => !votePill.IsLoading);
}
private void logIn() => API.Login("localUser", "password");
private Comment getUserComment() => new Comment
{
IsVoted = false,