public void JehrResultsValidResults()
        {
            var inModel = new RateReductionModel {
                SiteCode = "ABQZ", ContractType = "RJCP", CreationUserId = ""
            };
            var request  = MappingEngine.Map <JehrResultsListRequest>(inModel);
            var response = new JehrResultsListResponse()
            {
                ExecutionStatus  = PaymentsExecutionStatus.Success,
                ExecutionMessage = string.Empty,
                Moreflag         = "N",
                JehrResultsGroup = new List <JehrResultsGroup> {
                    new JehrResultsGroup()
                    {
                        JobseekerId = 8141313709
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <RateReductionModel>(response);

            mockMappingEngine.Setup(m => m.Map <JehrResultsListRequest>(inModel)).Returns(request);
            mockRateReductionsWcf.Setup(m => m.ListJehrResults(request)).Returns(response);
            mockMappingEngine.Setup(m => m.Map <RateReductionModel>(response)).Returns(outModel);

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

            Assert.IsTrue(result.ListOfResults.Count() == outModel.ListOfResults.Count());
            Assert.IsTrue(result.ListOfResults.First().ReductionRateValue == outModel.ListOfResults.First().ReductionRateValue);
            mockMappingEngine.Verify(m => m.Map <JehrResultsListRequest>(inModel), Times.Once());
            mockRateReductionsWcf.Verify(m => m.ListJehrResults(request), Times.Once());
            mockMappingEngine.Verify(m => m.Map <RateReductionModel>(response), Times.Once());
        }
        public void JrrrResultsWcfThrowsFaultExceptionValidationFaultThrowsServiceValidationException()
        {
            var exception = new FaultException <ValidationFault>(new ValidationFault {
                Details = new List <ValidationDetail> {
                    new ValidationDetail {
                        Key = "Key", Message = "Message"
                    }
                }
            });

            var inModel = new RateReductionModel {
                SiteCode = "ABQZ", ContractType = "RJCP"
            };
            var request  = MappingEngine.Map <JrrrResultsListRequest>(inModel);
            var response = new JrrrResultsListResponse {
                JrrrGroup = new List <JrrrGroup> {
                    new JrrrGroup()
                    {
                        JobseekerId = 8141313709
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <RateReductionModel>(response);

            mockMappingEngine.Setup(m => m.Map <JrrrResultsListRequest>(inModel)).Returns(request);
            mockRateReductionsWcf.Setup(m => m.ListJrrrResults(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <RateReductionModel>(response)).Returns(outModel);

            SystemUnderTest().ListJrrrResults(inModel);
        }
        public void JehrResultsThrowsFaultExceptionThrowsPaymentsFault()
        {
            var exception = new FaultException <PaymentsFault>(new PaymentsFault {
                Message = "Exception"
            });

            var inModel = new RateReductionModel {
                SiteCode = "ABQZ", ContractType = "RJCP"
            };
            var request  = MappingEngine.Map <JehrResultsListRequest>(inModel);
            var response = new JehrResultsListResponse()
            {
                JehrResultsGroup =
                    new List <JehrResultsGroup> {
                    new JehrResultsGroup()
                    {
                        JobseekerId = 8141313709
                    }
                }.ToArray()
            };

            var outModel = MappingEngine.Map <RateReductionModel>(response);

            mockMappingEngine.Setup(m => m.Map <JehrResultsListRequest>(inModel)).Returns(request);
            mockRateReductionsWcf.Setup(m => m.ListJehrResults(request)).Throws(exception);
            mockMappingEngine.Setup(m => m.Map <RateReductionModel>(response)).Returns(outModel);

            SystemUnderTest().ListJehrResults(inModel);
        }