public void UpdateCaseInfoBadRequestFailureTest() { var caseInfoDto = new CaseInfoDto { CaseId = 1, CaseNumber = "1", CourtNumber = "1", Value = 1, Judge = 'F', Court = "Test", CounterParty = "Test", Note = "Test", DateCreated = DateTime.Now, DateModified = DateTime.Now, IsDeleted = false, CaseCategory = 1, CustomerId = 1, ClientId = 1, CreatedByUserId = 1 }; var caseInfoRepo = new Mock <ICaseInfoRepository>(); caseInfoRepo.Setup(x => x.EditCaseInfoById(It.IsAny <int>(), It.IsAny <CaseInfoDto>())).Throws <Exception>(); var caseInfoManipulation = new CaseInfoManipulation(caseInfoRepo.Object); IMapper _mapper = new Mapper(null); var controller = new CaseInfoController(caseInfoManipulation, _mapper); var result = controller.Put(1, caseInfoDto); Assert.IsType <Boolean>(result); }
public void UpdateCaseInfoFailureTest() { var mockRepo = new Mock <ICaseInfoManipulation>(); IMapper _mapper = new Mapper(null); var controller = new CaseInfoController(mockRepo.Object, _mapper); controller.ModelState.AddModelError("error", "some error"); var result = controller.Put(1, null); Assert.IsType <Boolean>(result); }