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));
        }
Ejemplo n.º 2
0
 public IHttpActionResult Post([FromBody] MarginModel marginModel)
 {
     try
     {
         Utils.IsAValidToken(Request, AuthorizationBusinessLogic);
         MarginBusinessLogic.AddMargin(marginModel.ToEntity());
         return(Ok(marginModel));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }