public void GeneralPaymentsThrowsFaultExceptionThrowsPaymentsFault() { var exception = new FaultException <PaymentsFault>(new PaymentsFault { Message = "Exception" }); var inModel = new PaymentsModel { ContractId = "0205885C" }; var request = MappingEngine.Map <claimgeneralGetRequest>(inModel); var response = new claimgeneralGetResponse { OutGroup4Claim = new List <outGroup4Claim> { new outGroup4Claim { OutGrp4ClaimId = 12345678 } }.ToArray() }; var outModel = MappingEngine.Map <PaymentsModel>(response); mockMappingEngine.Setup(m => m.Map <claimgeneralGetRequest>(inModel)).Returns(request); mockGeneralPaymentsWcf.Setup(m => m.claimgeneralGetEXECUTE(request)).Throws(exception); mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel); SystemUnderTest().ListGeneralPayments(inModel); }
public void GeneralPaymentsValidResults() { var inModel = new PaymentsModel { ContractId = "0205885C" }; var request = MappingEngine.Map <claimgeneralGetRequest>(inModel); var response = new claimgeneralGetResponse { OutGroup4Claim = new List <outGroup4Claim> { new outGroup4Claim { OutGrp4ClaimId = 12345678 } }.ToArray() }; var outModel = MappingEngine.Map <PaymentsModel>(response); mockMappingEngine.Setup(m => m.Map <claimgeneralGetRequest>(inModel)).Returns(request); mockGeneralPaymentsWcf.Setup(m => m.claimgeneralGetEXECUTE(request)).Returns(response); mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel); var result = SystemUnderTest().ListGeneralPayments(inModel); Assert.IsTrue(result.ListOfPayments.Count() == outModel.ListOfPayments.Count()); Assert.IsTrue(result.ListOfPayments.First().ClaimId == outModel.ListOfPayments.First().ClaimId); mockMappingEngine.Verify(m => m.Map <claimgeneralGetRequest>(inModel), Times.Once()); mockGeneralPaymentsWcf.Verify(m => m.claimgeneralGetEXECUTE(request), Times.Once()); mockMappingEngine.Verify(m => m.Map <PaymentsModel>(response), Times.Once()); }
public void GeneralPaymentsWcfThrowsFaultExceptionValidationFaultThrowsServiceValidationException() { var exception = new FaultException <ValidationFault>(new ValidationFault { Details = new List <ValidationDetail> { new ValidationDetail { Key = "Key", Message = "Message" } } }); var inModel = new PaymentsModel { ContractId = "0205885C" }; var request = MappingEngine.Map <claimgeneralGetRequest>(inModel); var response = new claimgeneralGetResponse { OutGroup4Claim = new List <outGroup4Claim> { new outGroup4Claim { OutGrp4ClaimId = 12345678 } }.ToArray() }; var outModel = MappingEngine.Map <PaymentsModel>(response); mockMappingEngine.Setup(m => m.Map <claimgeneralGetRequest>(inModel)).Returns(request); mockGeneralPaymentsWcf.Setup(m => m.claimgeneralGetEXECUTE(request)).Throws(exception); mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel); SystemUnderTest().ListGeneralPayments(inModel); }