31 lines
1007 B
C#
31 lines
1007 B
C#
using UnityEngine;
|
|
|
|
/// <summary>
|
|
/// Test the UserCreationScreen class
|
|
/// </summary>
|
|
public class TestUserCreationScreen
|
|
{
|
|
/// <summary>
|
|
/// Tets IsValidUsername will return <c>true</c> for an valid username
|
|
/// </summary>
|
|
public void TestIsValidUsernameTrue()
|
|
{
|
|
foreach (char c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
|
Debug.Assert(UserCreationScreen.IsValidUsername(c.ToString()));
|
|
|
|
Debug.Assert(UserCreationScreen.IsValidUsername("123456789AbC"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tets IsValidUsername will return <c>false</c> for an invalid username
|
|
/// </summary>
|
|
public void TestIsValidUsernameFalse()
|
|
{
|
|
Debug.Assert(!UserCreationScreen.IsValidUsername(string.Empty));
|
|
foreach (char c in " \n\t+-*/%_.,;:!?(){}[]\\'\"|&~^$")
|
|
Debug.Assert(!UserCreationScreen.IsValidUsername(c.ToString()));
|
|
|
|
Debug.Assert(!UserCreationScreen.IsValidUsername("123456789_10_11_12_13"));
|
|
}
|
|
}
|