Example #1
0
        public async Task <(int code, string msg)> CreateUserAsync(CreateUserDto dto)
        {
            // ignore some params check...


            // here can use AutoMapper to impore
            var userInfo = dto.GetUserInfo();

            var isStrongPassword = userInfo.CheckIsStrongPassword();

            if (!isStrongPassword)
            {
                return(1001, "password is too weak");
            }

            var isSucc = await _repo.CreateUserAsync(userInfo);

            if (isSucc)
            {
                await _notifyBiz.SendEmail(userInfo.Email);

                _logger.LogInformation("create userinfo succeed..");
                return(0, "ok");
            }
            else
            {
                _logger.LogWarning("create userinfo fail..");
                return(9000, "error");
            }
        }
Example #2
0
 private void FakeCreateUserAsyncReturnFalse()
 {
     A.CallTo(() => _repo.CreateUserAsync(A <CoreLayer.Domains.UserInfo> ._)).Returns(Task.FromResult(false));
 }