public IActionResult SetPassword([FromBody] Models.Database.StoredProcedures.SP_User_SetPassword.Inputs data) { data.Token = User.GetToken(); var rst = _ctx.SP_User_SetPassword(data); return(FromDatabase(rst)); }
public void SP_User_SetPassword_WhenPassingInvalidData_ThrowsArgumentException(string token, int userId, string password) { var inputs = new Models.Database.StoredProcedures.SP_User_SetPassword.Inputs() { Token = token, UserId = userId, Password = password }; Assert.That(() => _dbCTX.SP_User_SetPassword(inputs), Throws.ArgumentException); }
public void SP_User_SetPassword_WhenPassingValidData_ItRunsCallMethod() { var inputs = new Models.Database.StoredProcedures.SP_User_SetPassword.Inputs() { Token = "TokenValue", UserId = 1, Password = "******" }; var sp = new Mock <Models.Database.ISP <Models.Database.StoredProcedures.SP_User_SetPassword.Inputs> >(); _dbCTX.SP_User_SetPassword(inputs, sp.Object); sp.Verify(s => s.Call(inputs)); }
public IActionResult SetPassword([FromBody] Models.Database.StoredProcedures.SP_User_SetPassword.Inputs data) { try { data.Token = User.GetToken(); var rst = _ctx.SP_User_SetPassword(data); return(FromDatabase(rst)); } catch (Exception e) { _logger.Add(e, "Error in UsersController.SetPassword(data)"); return(Problem(e.Message, e.StackTrace, 500, "Error in SetPassword")); } }
public void SP_User_SetPassword_WhenPassingValidData_ItReturnDBResult() { var inputs = new Models.Database.StoredProcedures.SP_User_SetPassword.Inputs() { Token = "TokenValue", UserId = 1, Password = "******" }; var sp = new Mock <Models.Database.ISP <Models.Database.StoredProcedures.SP_User_SetPassword.Inputs> >(); sp.Setup(s => s.Call(inputs)).Returns(new Models.Database.DBResult()); var result = _dbCTX.SP_User_SetPassword(inputs, sp.Object); Assert.That(result, Is.Not.Null); Assert.That(result, Is.TypeOf(typeof(Models.Database.DBResult))); }
public DBResult SP_User_SetPassword(Models.Database.StoredProcedures.SP_User_SetPassword.Inputs inputs, ISP <Models.Database.StoredProcedures.SP_User_SetPassword.Inputs> sp = null) { if (inputs == null) { throw new ArgumentNullException("Invalid inputs data."); } if (!inputs.IsValid()) { throw new ArgumentException("Invalid input data."); } if (sp == null) { sp = new FTSS.DP.DapperORM.StoredProcedure.SP_User_SetPassword(GetConnectionString()); } var rst = sp.Call(inputs); return(rst); }