S
S
sergeushenets2015-11-29 04:08:18
ASP.NET
sergeushenets, 2015-11-29 04:08:18

Testing Register method in AccountController Aps.net web api?

I can’t understand how it’s possible to check the Register method through a unit test, I can’t do this
by the default method created by the studio
[AllowAnonymous]
[Route("Register")]
public async Task Register(RegisterBindingModel model)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
ApplicationUser user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
IdentityResult result = await UserManager.CreateAsync(user, model.Password);
if (!result.Succeeded)
{
return GetErrorResult(result);
}
return Ok();
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
heartdevil, 2015-11-29
@heartdevil

Hello.
Here they solve a similar problem. You have to fiddle around a lot.

S
sergeushenets, 2015-11-29
@sergeushenets

heartdevil I watched it but it didn't help me much, I need something more specific for my

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question