public void Test_Visa_Pay_Right_Type_Of_Action_Result() { //arrange VisaPayMethod payMethod = new VisaPayMethod(); //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; }