public ActionResult DeleteInvit(string idV, int idA) { //try //{ var x = invtService.FordeleteInv(idA, idV); foreach (Invitation i in x) { invtService.Delete(i); } try { invtService.Commit(); } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { foreach (var entityValidationErrors in ex.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage); } } // } // catch // { //return View(); // } } return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); }
public async void Delete() { var mock = new ServiceMockFacade <IInvitationRepository>(); var model = new ApiInvitationRequestModel(); mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <string>())).Returns(Task.CompletedTask); var service = new InvitationService(mock.LoggerMock.Object, mock.RepositoryMock.Object, mock.ModelValidatorMockFactory.InvitationModelValidatorMock.Object, mock.BOLMapperMockFactory.BOLInvitationMapperMock, mock.DALMapperMockFactory.DALInvitationMapperMock); ActionResponse response = await service.Delete(default(string)); response.Should().NotBeNull(); mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <string>())); mock.ModelValidatorMockFactory.InvitationModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <string>())); }