public void payRequestHelpForTestCase2Test()
 {
     var rId = "test2";
     var bankPara = new BankParaWarp { ProcessTime = 5500, Result = "failed" };
     var creatBillPara = new createBillParaWarp { Method = payMethod.sync, BankPara = bankPara };
     var testPara = new testParameter { ReqId = rId, WaitTime = 5000, CreatBillPara = creatBillPara };
     var test = new inTimePayControllerHelpController();
     var res = test.payRequestHelpForTest(rId, testPara);
     Assert.IsTrue(res == null);
 }
 public void payRequestHelpForTestCase3Test()
 {
     var rId = "test3";
     var bankPara = new BankParaWarp { ProcessTime = 2000, Result = string.Empty };
     var creatBillPara = new createBillParaWarp { Method = payMethod.async, BankPara = bankPara };
     var testPara = new testParameter { ReqId = rId, WaitTime = 5000, CreatBillPara = creatBillPara };
     var test = new inTimePayControllerHelpController();
     var res = test.payRequestHelpForTest(rId, testPara);
     var assR = new inTimeRes { PaymentResult = string.Empty, PayMethod = payMethod.async };
     Assert.AreEqual(res.PaymentResult, assR.PaymentResult);
     Assert.AreEqual(res.PayMethod, assR.PayMethod);
 }
 public inTimeRes payRequestHelpForTest([FromUri]string reqId, testParameter testPara)//int waitTime = 5000, payMethod method = payMethod.sync, int processTime = 2000, string result = "ok")
 {
     return new inTimePayControllerHelp().realPayRequestHelp(reqId, (pm, pt, rt) =>
          {
              var forCreateBill = new createBillParaWarp { Para = new inTimeReqPara { ReqId  = reqId}, Method = pm, BankPara = new BankParaWarp { ProcessTime = pt, Result = rt } };
              using (var client = new HttpClient())
              {
                  client.BaseAddress = new Uri("http://win8dev");
                  client.DefaultRequestHeaders.Accept.Add(
                      new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                  var resp = client.PostAsJsonAsync("inTimePayment/api/paySOA/createBillHelpForTest", new createBillParaWarp{Para = new inTimeReqPara{ReqId=reqId},Method=pm,BankPara = new BankParaWarp{ProcessTime=pt,Result=rt}}).Result;
                  var resContent = resp.Content.ReadAsAsync<paymentEntity>();
                  //using (var req = new BankServiceClient())
                  //{
                  //    req.processPaymentHelp(be);
                  //}
                  ////using (var req = new PaymentServiceClient())
                  //{
                  //    req.paymentResultHookHelp(res);
                  //}
                  return resContent.Result;
              }
          }, testPara.WaitTime, testPara.CreatBillPara.Method, testPara.CreatBillPara.BankPara.ProcessTime, testPara.CreatBillPara.BankPara.Result);
 }