public IHttpActionResult Put([FromUri] Guid id, [FromBody] TextModel textModel) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); textModel.Id = id; TextBusinessLogic.ModifyText(textModel.ToEntity()); Guid?documentId = TextBusinessLogic.GetDocumentId(id); AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY); return(Ok("Text Modified")); } catch (Exception e) { return(BadRequest(e.Message)); } }
public void IntegrationTest_ExpectedParameters_Ok() { TextDataAccess textDA = new TextDataAccess(); BodyDataAccess bodyDA = new BodyDataAccess(); TextBusinessLogic textBL = new TextBusinessLogic(textDA); Text text1 = Utils.CreateTextForTest(); Text text2 = Utils.CreateTextForTest(); textBL.AddText(text1); textBL.AddText(text2); text2.OwnStyleClass = "Other style"; textBL.ModifyText(text2); textBL.DeleteText(text1.Id); Text text2Obtained = textBL.GetText(text2.Id); IList <Text> textsObtained = textBL.GetTexts(); Assert.IsTrue(!textsObtained.Contains(text1) && textsObtained.Contains(text2Obtained)); }