Last active
March 26, 2018 01:29
-
-
Save dance2die/5897ad07ed0411dfec9cc2c22b0d3fbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void ProcessPayments() | |
{ | |
var paymentProviders = new[] { | |
"Paypal", "ApplePay", "GooglePay", | |
"Braintree", "PayPal", "ApplePay", | |
"ApplePay", "BadPaymentProvider" }; | |
foreach (var paymentProvider in paymentProviders) | |
{ | |
var paymentProcessor = PaymentStrategyFactory.Create(paymentProvider); | |
WriteLine($"===== Processing with '{paymentProvider}' Provider ====="); | |
// There is no need to check if the payment processor is null here | |
// Reduced Cyclomatic Complexity. | |
var paymentStatus = paymentProcessor.Process(111); | |
WriteLine($"--> {paymentStatus}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment