Esempio n. 1
0
        public JsonResult Delete(EducationModel model)
        {
            try
            {
                #region " [ Declaration ] "

                EducationService _service = new EducationService();

                #endregion

                #region " [ Main process ] "

                model.CreateBy   = UserID;
                model.DeleteBy   = UserID;
                model.DeleteDate = DateTime.Now;

                #endregion

                //Call to service
                return(this.Json(_service.Delete(model), JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException serviceEx)
            {
                throw serviceEx;
            }
            catch (DataAccessException accessEx)
            {
                throw accessEx;
            }
            catch (Exception ex)
            {
                throw new ControllerException(FILE_NAME, "Delete", UserID, ex);
            }
        }
Esempio n. 2
0
        public void DeleteEducation_InvalidEducationId_ShouldBeThrownValidationException()
        {
            Mock <IUnitOfWork> uow     = new Mock <IUnitOfWork>();
            EducationService   service = new EducationService(uow.Object);

            uow.Setup(a => a.Educations.Get(It.IsAny <int>())).Returns((Education)null);
            service.Delete(It.IsAny <int>());
        }
Esempio n. 3
0
        public void DeleteEducation_DeletedEducationWithCorrectId_ShouldBeDeleted()
        {
            Mock <IUnitOfWork> uow     = new Mock <IUnitOfWork>();
            EducationService   service = new EducationService(uow.Object);

            uow.Setup(a => a.Educations.Get(It.IsAny <int>())).Returns(new Education());
            service.Delete(It.IsAny <int>());
            uow.Verify(x => x.Save());
        }