public void CreateAccount_Fail_BadEmail() { var badEmail = "winn@asdf"; var expected = new BadRequestObjectResult("Invalid Email address"); var request = tu.CreateAccountRequest(); request.EmailAddress = badEmail; var actual = uam.CreateUserAccount(request); Assert.AreEqual(expected, actual); }
public ActionResult CreateAccount([FromBody] AccountRequest request) { try { UserAccountManager _userAccountManager = new UserAccountManager(new MongoClient(MONGODB_CONNECTION_STRING)); return(_userAccountManager.CreateUserAccount(request)); } catch { return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } }
public bool Register(RegisterViewModel registerModel) { UserAccountDto userAccountDto = CommonHelper.ConvertTo <UserAccountDto>(registerModel.UserAccount); if (_userAccountManager.CreateUserAccount(userAccountDto)) { UserAccountDto loginData = _userAccountManager.GetUserLoginData(registerModel.UserAccount.USERNAME, registerModel.UserAccount.PASSWORD); registerModel.UserInfo.USERID = loginData.USERID; UserRoleMapDto userRoleMapDto = new UserRoleMapDto(); switch (registerModel.UserType) { case "admin": { userRoleMapDto.USERID = loginData.USERID; userRoleMapDto.ROLEID = 1; break; } case "customer": { userRoleMapDto.USERID = loginData.USERID; userRoleMapDto.ROLEID = 2; break; } case "citizen": { userRoleMapDto.USERID = loginData.USERID; userRoleMapDto.ROLEID = 3; break; } } bool isUserRoleCreated = _userRoleMapManager.CreateUserRoleMap(userRoleMapDto); if (isUserRoleCreated) { return(CreateUserInformation(registerModel.UserInfo)); } } return(false); }