mirror of
https://github.com/Ikatono/ComiServ.git
synced 2025-10-28 20:45:35 -05:00
39 lines
824 B
C#
39 lines
824 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using ComiServ.Entities;
|
|
using ComiServ.Services;
|
|
|
|
namespace ComiServUnitTest;
|
|
|
|
[TestClass]
|
|
public class AuthenticationServiceTests
|
|
{
|
|
[TestMethod]
|
|
public void FailAuth()
|
|
{
|
|
IAuthenticationService auth = new AuthenticationService();
|
|
Assert.IsFalse(auth.Tested);
|
|
auth.FailAuth();
|
|
Assert.IsTrue(auth.Tested);
|
|
Assert.IsNull(auth.User);
|
|
}
|
|
[TestMethod]
|
|
public void AuthenticateUser()
|
|
{
|
|
IAuthenticationService auth = new AuthenticationService();
|
|
User user = new()
|
|
{
|
|
Username = "NewUser",
|
|
UserTypeId = UserTypeEnum.User,
|
|
};
|
|
Assert.IsFalse(auth.Tested);
|
|
auth.Authenticate(user);
|
|
Assert.IsTrue(auth.Tested);
|
|
Assert.IsNotNull(auth.User);
|
|
Assert.AreSame(user, auth.User);
|
|
}
|
|
}
|