Пример #1
0
        public void DeleteTypeReqTest()
        {
            typeReqRepository.SetupSequence(r => r.Exists(It.IsAny <Expression <Func <TypeReqEntity, bool> > >())).Returns(true);
            typeReqRepository.Setup(r => r.FirstOrDefault(It.IsAny <Expression <Func <TypeReqEntity, bool> > >())).Returns(testTypeReqEntity);
            typeReqRepository.Setup(r => r.Update(It.IsAny <TypeReqEntity>())).Verifiable();
            aFRepository.Setup(a => a.Get(It.IsAny <Expression <Func <AdditionalFieldEntity, bool> > >())).Returns(new List <AdditionalFieldEntity>());
            unitOfWork.Setup(r => r.Save());

            typeReqLogic.Delete(testTypeReqEntity.Id);

            typeReqRepository.VerifyAll();
        }
Пример #2
0
 public IActionResult Delete(int id)
 {
     try
     {
         typeReqLogic.Delete(id);
         return(this.Ok());
     }
     catch (ArgumentException e)
     {
         return(BadRequest(e.Message));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }