public void Test_IBox_Pay_Return_Right_Action_Result() { //arrange IBoxPayMethod payMethod = new IBoxPayMethod(); //act var result = payMethod.Pay(model); //assert Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public object BindModel( ControllerContext controllerContext, ModelBindingContext bindingContext ) { var payType = controllerContext.RouteData.Values["payType"].ToString(); IPayMethod payMethod = null; switch (payType) { case "Bank": payMethod = new BankPayMethod(); break; case "IBox": payMethod = new IBoxPayMethod(); break; case "Visa": payMethod = new VisaPayMethod(); break; } return payMethod; }