public void getCaseByIdTest() { var caseInfo = new CaseInfo { 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 mockRepo = new Mock <ICaseInfoRepository>(); mockRepo.Setup(x => x.GetCaseInfoById(It.Is <int>(q => q == 1))).Returns(caseInfo); var caseInfoManipulation = new CaseInfoManipulation(mockRepo.Object); IMapper _mapper = new Mapper(null); var controller = new CaseInfoController(caseInfoManipulation, _mapper); var result = controller.Get(1); var okObjectResult = result as OkObjectResult; Assert.NotNull(okObjectResult); var model = okObjectResult.Value as CaseInfo; Assert.NotNull(model); output.WriteLine(model.CaseNumber); Assert.IsType <OkObjectResult>(result); }
public void geCaseInfosTest() { var caseInfo = 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 addresses = new List <CaseInfoDto> { caseInfo }; var mockRepo = new Mock <ICaseInfoRepository>(); mockRepo.Setup(x => x.GetCaseInfos()).Returns(addresses); var caseInfoManipulation = new CaseInfoManipulation(mockRepo.Object); IMapper _mapper = new Mapper(null); var controller = new CaseInfoController(caseInfoManipulation, _mapper); var result = controller.Get(); var okObjectResult = result as OkObjectResult; Assert.NotNull(okObjectResult); Assert.IsType <OkObjectResult>(result); }