mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-04-05 17:38:01 +08:00
29 lines
915 B
C#
29 lines
915 B
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using OpenAuth.App;
|
|
using OpenAuth.App.DTO;
|
|
using OpenAuth.Domain.Service;
|
|
using OpenAuth.Repository.Repository;
|
|
|
|
namespace OpenAuth.UnitTest
|
|
{
|
|
[TestClass]
|
|
public class LoginTest
|
|
{
|
|
|
|
[TestMethod]
|
|
public void Login()
|
|
{
|
|
var loginReq = new LoginRequest { UserName = "admin", Password = "123456" };
|
|
var loginApp = new LoginApp(new LoginService(new UserRepository()));
|
|
var response = loginApp.Login(loginReq);
|
|
Assert.IsTrue(response.Success);
|
|
Assert.AreEqual(response.UserName, loginReq.UserName);
|
|
|
|
var errPassword = new LoginRequest { UserName = "admin", Password = "111111" };
|
|
response = loginApp.Login(errPassword);
|
|
Assert.IsFalse(response.Success);
|
|
Assert.AreEqual(response.Message, "密码错误");
|
|
}
|
|
}
|
|
}
|