2019-03-05 13:05:19 +08:00
|
|
|
|
using System;
|
2019-05-14 15:08:46 +08:00
|
|
|
|
using System.Linq;
|
2019-03-05 13:05:19 +08:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
2019-05-15 00:22:13 +08:00
|
|
|
|
namespace Bootstrap.DataAccess.SqlServer
|
2019-03-05 13:05:19 +08:00
|
|
|
|
{
|
|
|
|
|
[Collection("SQLServerContext")]
|
|
|
|
|
public class ResetUserTest
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
2019-05-14 15:08:46 +08:00
|
|
|
|
public void ResetReasonsByUserName_Ok()
|
2019-03-05 13:05:19 +08:00
|
|
|
|
{
|
2019-05-14 15:08:46 +08:00
|
|
|
|
var user = new User { UserName = "UnitTestReset", Password = "1", DisplayName = "DisplayName", ApprovedBy = "System", ApprovedTime = DateTime.Now, Description = "Desc", Icon = "default.jpg" };
|
|
|
|
|
Assert.True(UserHelper.Save(user));
|
2019-03-05 13:05:19 +08:00
|
|
|
|
|
2019-05-14 15:08:46 +08:00
|
|
|
|
UserHelper.ForgotPassword(new ResetUser() { UserName = user.UserName, DisplayName = user.DisplayName, Reason = "UnitTest", ResetTime = DateTime.Now });
|
|
|
|
|
Assert.NotNull(UserHelper.RetrieveResetUserByUserName(user.UserName));
|
2019-03-05 14:53:34 +08:00
|
|
|
|
|
2019-05-14 15:08:46 +08:00
|
|
|
|
var reasons = UserHelper.RetrieveResetReasonsByUserName(user.UserName);
|
2019-03-05 14:53:34 +08:00
|
|
|
|
Assert.NotEmpty(reasons);
|
2019-06-01 16:57:33 +08:00
|
|
|
|
|
|
|
|
|
UserHelper.Delete(new string[] { user.Id });
|
2019-03-05 14:53:34 +08:00
|
|
|
|
}
|
2019-05-18 21:21:03 +08:00
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Save_Ok()
|
|
|
|
|
{
|
|
|
|
|
Assert.True(ResetUserHelper.Save(new ResetUser() { UserName = "U_Reset", DisplayName = "UnitTest", Reason = "UnitTest" }));
|
|
|
|
|
}
|
2019-03-05 13:05:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|