// Factory Method public static IPayment GetPaymentObject(int objType) { IPayment _IPayment; if (objType == Constant.PaymentType.ProductDetails.GetHashCode()) { _IPayment = new ProductDetailsPayment(); } else if (objType == Constant.PaymentType.Employee.GetHashCode()) { _IPayment = new EmployeePayment(); } else if (objType == Constant.PaymentType.EmployeeActivate.GetHashCode()) { _IPayment = new EmployeeMemberActivatePayment(); } else if (objType == Constant.PaymentType.MembershipUpgrade.GetHashCode()) { _IPayment = new MembershipUpgradePayment(); } else if (objType == Constant.PaymentType.Video.GetHashCode()) { _IPayment = new VideoPayment(); } else { _IPayment = null; } return(_IPayment); }
// Factory Method public static IPayment GetPaymentObject(int objType) { IPayment _IPayment; if (objType == Constant.PaymentType.PhysicalProduct.GetHashCode()) { _IPayment = new PhysicalProductPayment(); } else if (objType == Constant.PaymentType.Book.GetHashCode()) { _IPayment = new BookPayment(); } else if (objType == Constant.PaymentType.MembershipActivate.GetHashCode()) { _IPayment = new MembershipActivatePayment(); } else if (objType == Constant.PaymentType.MembershipUpgrade.GetHashCode()) { _IPayment = new MembershipUpgradePayment(); } else if (objType == Constant.PaymentType.Video.GetHashCode()) { _IPayment = new VideoPayment(); } else { _IPayment = null; } return(_IPayment); }
public void Test_MembershipUpgradePayment() { IPayment membershipPayment = new MembershipUpgradePayment(); IProduct product = new Membership(membershipPayment); IOrderProcessor processor = new OrderProcessor(); processor.ProcessOrder(product); Assert.Equal("Apply upgrade to membership", product.Status); }