public IActionResult Post([FromBody] UserSignupModel signupModel) { try { const string user = "******"; if (signupModel.Password.Length < 8) { throw new UserInputException("Password must be at least 8 characters"); } ValidateModel(signupModel); var result = _webPageHelper.SignUp(signupModel, user); return(Ok(result)); } catch (UserInputException ex) { _logger.Error(ex.Message); return(StatusCode((int)HttpStatusCode.NotAcceptable, ex.Message)); } catch (Exception ex) { _logger.Error($"Unhandled exception occurred when attempting to sign up", ex); return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message)); } }
public void SignUp_NoCreditCardWithNonFreeAccount() { const string user = "******"; //arrange var signupModel = new UserSignupModel { CreditCardNumber = null, PricingTierId = (byte)StaticData.StaticPricingTier.Standard }; //act / assert var ex = Assert.Throws <UserInputException>(() => _webPageHelper.SignUp(signupModel, user)); AssertWithMessage.AreEqual(ex.Message, "Credit card information must be provided for any non-free account", "exception message"); }