public async Task SignUp_UserNotRegistered_ReturnsOk() { var registration = new Mock <IRegistration>(); registration.Setup(register => register.RegisterUser(new RegisterUsers())).ReturnsAsync(true); var registrationController = new RegistrationController(registration.Object); var result = await registrationController.SignUp(new RegisterUsers()); var okResult = new OkObjectResult(result); Assert.AreEqual(200, okResult.StatusCode); }
public async Task SignUp_UserIsRegistered_ReturnsBadRequest() { var registration = new Mock <IRegistration>(); registration.Setup(register => register.RegisterUser(new RegisterUsers())).ReturnsAsync(true); var registrationController = new RegistrationController(registration.Object); var result = await registrationController.SignUp(new RegisterUsers()); var badResult = new BadRequestObjectResult(result); Assert.AreEqual(400, badResult.StatusCode); }