public IHttpActionResult Delete([FromUri] Guid id) { try { Utils.IsAValidToken(Request, AuthorizationBusinessLogic); Guid?documentId = TextBusinessLogic.GetDocumentId(id); TextBusinessLogic.DeleteText(id); AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY); return(Ok("Text deleted")); } 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)); }