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