public void WithdrawPaymentThrowsFaultExceptionThrowsServiceValidationException()
        {
            var exception = new FaultException(new FaultReason("fault reason"), new FaultCode("fault code"));

            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().WithdrawGeneralPayment(inModel);
        }
        public void WithdrawPaymentThrowsFaultExceptionThrowsPaymentsFault()
        {
            var exception = new FaultException <PaymentsFault>(new PaymentsFault {
                Message = "Service validation exception"
            });

            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().WithdrawGeneralPayment(inModel);
        }
        public void WithdrawPaymentValidResults()
        {
            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Returns(response);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            var result = SystemUnderTest().WithdrawGeneralPayment(inModel);

            Assert.IsTrue(result.PaymentId == outModel.PaymentId);
            mockMappingEngine.Verify(m => m.Map <claimgeneralWithdrawRequest>(inModel), Times.Once());
            mockGeneralPaymentsWcf.Verify(m => m.claimgeneralWithdrawEXECUTE(request), Times.Once());
            mockMappingEngine.Verify(m => m.Map <PaymentsModel>(response), Times.Once());
        }
        public void WithdrawPaymentWcfThrowsFaultExceptionValidationFaultThrowsServiceValidationException()
        {
            var exception = new FaultException <ValidationFault>(new ValidationFault {
                Details = new List <ValidationDetail> {
                    new ValidationDetail {
                        Key = "Key", Message = "Message"
                    }
                }
            });

            var inModel = new PaymentsModel {
                PaymentId = 439457997
            };
            var request  = MappingEngine.Map <claimgeneralWithdrawRequest>(inModel);
            var response = new claimgeneralWithdrawResponse();
            var outModel = MappingEngine.Map <PaymentsModel>(response);

            mockMappingEngine.Setup(m => m.Map <claimgeneralWithdrawRequest>(inModel)).Returns(request);
            mockGeneralPaymentsWcf.Setup(m => m.claimgeneralWithdrawEXECUTE(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <PaymentsModel>(response)).Returns(outModel);

            SystemUnderTest().WithdrawGeneralPayment(inModel);
        }