private static async Task GeneralAssertAsync(UserItemDto dtoFound, UserAppService target) { Assert.AreEqual("test", dtoFound.Username); Assert.AreEqual("TestUser", dtoFound.Name); Assert.AreEqual("abc.png", dtoFound.Avatar); Assert.AreEqual("*****@*****.**", dtoFound.Email); Assert.AreEqual("123", dtoFound.IdCardNo); Assert.AreEqual("123", dtoFound.EmployeeNumber); Assert.AreEqual(true, dtoFound.IsActive); Assert.AreEqual("123", dtoFound.Mobile); Assert.IsTrue(await target.CheckPasswordAsync(dtoFound.Id, "abc")); Assert.AreEqual(DateTimeOffset.UtcNow.DayOfYear, dtoFound.Created.Value.DayOfYear); }
public async Task Test_CreateUser_UpdatePassword_FindById() { var(target, dto) = CreateTargetAndDto(); var result = await target.CreateUserAsync(dto); Assert.IsNotNull(result); var dtoFound = await target.FindByIdAsync(dto.Id); await GeneralAssertAsync(dtoFound, target); result = await target.UpdatePasswordAsync("123", "xyz"); Assert.IsNotNull(result); dtoFound = await target.FindByIdAsync(dto.Id); Assert.IsTrue(await target.CheckPasswordAsync(dtoFound.Id, "xyz")); Assert.IsNotNull(dtoFound.Modified); }