示例#1
0
 public IHttpActionResult Delete([FromUri] Guid id)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         Guid documentId = MarginBusinessLogic.GetMargin(id).DocumentId.Value;
         MarginBusinessLogic.DeleteMargin(id);
         AuditLogBussinesLogic.CreateLog("Document", documentId, Utils.GetUsername(Request), ActionPerformed.MODIFY);
         return(Ok("Margin deleted"));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
        public void IntegrationTest_ExpectedParameters_Ok()
        {
            MarginDataAccess    marginDA = new MarginDataAccess();
            MarginBusinessLogic marginBL = new MarginBusinessLogic(marginDA);
            Margin margin1 = Utils.CreateMarginForTest();
            Margin margin2 = Utils.CreateMarginForTest();

            marginBL.AddMargin(margin1);
            marginBL.AddMargin(margin2);

            margin2.SetText(text);
            marginBL.ModifyMargin(margin2);

            marginBL.DeleteMargin(margin1.Id);

            Margin         margin2Obtained = marginBL.GetMargin(margin2.Id);
            IList <Margin> marginsObtained = marginBL.GetMargins();

            Assert.IsTrue(!marginsObtained.Contains(margin1) && marginsObtained.Contains(margin2Obtained));
        }