public LoanRequestResponse ValidateLoanRequest(LoanRequestRequest request) { LoanRequestResponse response = new LoanRequestResponse(); response.AmmountRequested = request.AmmountRequested; response.ErrorMessage = this.ValidateClientInformation(request); if (string.IsNullOrEmpty(response.ErrorMessage)) { response.ErrorMessage = this.ValidateRiskCenter(request); if (string.IsNullOrEmpty(response.ErrorMessage)) { response.ErrorMessage = this.ValidateBorrowingCapacity(request); if (string.IsNullOrEmpty(response.ErrorMessage)) { response.AmmountApproved = this.CalculateAmmountApproved(request); } } else { response.ControlRiskStateReported = true; } } response.Approved = response.AmmountApproved > 0; return(response); }
public void RunTest(List <int> idTestCases) { foreach (var idTestCase in idTestCases) { TestCase testCase = testDataAccess.GetTestCase(idTestCase); bool success = false; if (testCase != null && testCase.IdTestCase > 0) { LoanRequestRequest request = (LoanRequestRequest)XmlHelper.XmlDeserializeFromString(testCase.Input, typeof(LoanRequestRequest)); LoanRequestResponse response = loanClient.LoanRequest(request); success = ValidateTestCase(idTestCase, response); } else { //throw new Exception(string.Format("There is no a test case with the parameter idTestCase = {0}", testCase)); success = false; } } }