public IActionResult Update([FromBody] Models.Database.StoredProcedures.SP_User_Update.Inputs data) { data.Token = User.GetToken(); var rst = _ctx.SP_User_Update(data); return(FromDatabase(rst)); }
public void SP_User_Update_WhenPassingInvalidData_ThrowsArgumentException(string token, int userId, string email, string lastName) { var inputs = new Models.Database.StoredProcedures.SP_User_Update.Inputs() { Token = token, UserId = userId, Email = email, LastName = lastName }; Assert.That(() => _dbCTX.SP_User_Update(inputs), Throws.ArgumentException); }
public IActionResult Update([FromBody] Models.Database.StoredProcedures.SP_User_Update.Inputs data) { try { data.Token = User.GetToken(); var rst = _ctx.SP_User_Update(data); return(FromDatabase(rst)); } catch (Exception e) { _logger.Add(e, "Error in UsersController.Update(data)"); return(Problem(e.Message, e.StackTrace, 500, "Error in Update")); } }
public void SP_User_Update_WhenPassingValidData_ItRunsCallMethod() { var inputs = new Models.Database.StoredProcedures.SP_User_Update.Inputs() { Token = "TokenValue", UserId = 1, Email = "email", LastName = "lastName" }; var sp = new Mock <Models.Database.ISP <Models.Database.StoredProcedures.SP_User_Update.Inputs> >(); _dbCTX.SP_User_Update(inputs, sp.Object); sp.Verify(s => s.Call(inputs)); }
public void SP_User_Update_WhenPassingValidData_ItReturnDBResult() { var inputs = new Models.Database.StoredProcedures.SP_User_Update.Inputs() { Token = "TokenValue", UserId = 1, Email = "email", LastName = "lastName" }; var sp = new Mock <Models.Database.ISP <Models.Database.StoredProcedures.SP_User_Update.Inputs> >(); sp.Setup(s => s.Call(inputs)).Returns(new Models.Database.DBResult()); var result = _dbCTX.SP_User_Update(inputs, sp.Object); Assert.That(result, Is.Not.Null); Assert.That(result, Is.TypeOf(typeof(Models.Database.DBResult))); }
public DBResult SP_User_Update(Models.Database.StoredProcedures.SP_User_Update.Inputs inputs, ISP <Models.Database.StoredProcedures.SP_User_Update.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_Update(GetConnectionString()); } var rst = sp.Call(inputs); return(rst); }