您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
44 行
1.3 KiB
44 行
1.3 KiB
using LobbyRelaySample;
|
|
using NUnit.Framework;
|
|
|
|
namespace Test
|
|
{
|
|
public class LobbyTests
|
|
{
|
|
LocalLobby m_LocalLobby;
|
|
|
|
const int k_TestUserCount = 3;
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
m_LocalLobby = new LocalLobby();
|
|
|
|
for (int i = 0; i < k_TestUserCount; i++)
|
|
{
|
|
m_LocalLobby.AddPlayer(new LobbyUser
|
|
{
|
|
ID = i.ToString()
|
|
});
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void LobbyPlayerStateTest()
|
|
{
|
|
Assert.False(m_LocalLobby.PlayersOfState(UserStatus.Ready));
|
|
|
|
m_LocalLobby.LobbyUsers["0"].UserStatus = UserStatus.Ready;
|
|
Assert.False(m_LocalLobby.PlayersOfState(UserStatus.Ready));
|
|
Assert.True(m_LocalLobby.PlayersOfState(UserStatus.Ready, 1));
|
|
|
|
m_LocalLobby.LobbyUsers["1"].UserStatus = UserStatus.Ready;
|
|
Assert.False(m_LocalLobby.PlayersOfState(UserStatus.Ready));
|
|
Assert.True(m_LocalLobby.PlayersOfState(UserStatus.Ready, 2));
|
|
|
|
m_LocalLobby.LobbyUsers["2"].UserStatus = UserStatus.Ready;
|
|
|
|
Assert.True(m_LocalLobby.PlayersOfState(UserStatus.Ready));
|
|
}
|
|
}
|
|
}
|