public async Task CanRegisterUser() { var model = new RegisterBindingModel { UserName = "******" + DateTimeOffset.Now.Ticks, Password = "******", ConfirmPassword = "******" }; uri = uriBase + "/register"; var response = await PostAsync(model); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); }
public async Task<IHttpActionResult> Register(RegisterBindingModel model) { if (!ModelState.IsValid) { return BadRequest(ModelState); } IdentityUser user = new IdentityUser { UserName = model.UserName }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); IHttpActionResult errorResult = GetErrorResult(result); if (errorResult != null) { return errorResult; } return Ok(); }