You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
919 B
29 lines
919 B
using System;
|
|
using Jellyfin.Server.Implementations.Users;
|
|
using Xunit;
|
|
|
|
namespace Jellyfin.Server.Implementations.Tests.Users
|
|
{
|
|
public class UserManagerTests
|
|
{
|
|
[Theory]
|
|
[InlineData("this_is_valid")]
|
|
[InlineData("this is also valid")]
|
|
[InlineData("0@_-' .")]
|
|
public void ThrowIfInvalidUsername_WhenValidUsername_DoesNotThrowArgumentException(string username)
|
|
{
|
|
var ex = Record.Exception(() => UserManager.ThrowIfInvalidUsername(username));
|
|
Assert.Null(ex);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(" ")]
|
|
[InlineData("")]
|
|
[InlineData("special characters like & $ ? are not allowed")]
|
|
public void ThrowIfInvalidUsername_WhenInvalidUsername_ThrowsArgumentException(string username)
|
|
{
|
|
Assert.Throws<ArgumentException>(() => UserManager.ThrowIfInvalidUsername(username));
|
|
}
|
|
}
|
|
}
|