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
888 B
29 lines
888 B
using System;
|
|
using Jellyfin.Server.Implementations.Users;
|
|
using Xunit;
|
|
|
|
namespace Jellyfin.Server.Implementations.Tests.Users
|
|
{
|
|
public class UserManagerTests
|
|
{
|
|
[Theory]
|
|
[InlineData("this_is_valid", true)]
|
|
[InlineData("this is also valid", true)]
|
|
[InlineData(" ", false)]
|
|
[InlineData("", false)]
|
|
[InlineData("0@_-' .", true)]
|
|
public void ThrowIfInvalidUsername_WhenInvalidUsername_ThrowsArgumentException(string username, bool isValid)
|
|
{
|
|
var ex = Record.Exception(() => UserManager.ThrowIfInvalidUsername(username));
|
|
|
|
var argumentExceptionNotThrown = ex is not ArgumentException;
|
|
if (ex != null)
|
|
{
|
|
Assert.Equal(typeof(ArgumentException), ex.GetType());
|
|
}
|
|
|
|
Assert.Equal(isValid, argumentExceptionNotThrown);
|
|
}
|
|
}
|
|
}
|