This C# console application demonstrates the Strategy design pattern to process payments using different strategies: Credit Card, PayPal, and Mobile payments.
- Strategy Pattern: Switch between Credit Card, PayPal, and Mobile payment methods.
- Immutable Model: Ensures payment details remain unchanged.
- User Interaction: Select payment method during runtime.
- Extensible: Easily add new payment strategies.
-
Run the application:
dotnet run
-
Select a payment strategy:
1
: Credit Card2
: PayPal3
: Mobile
-
Process the payment and see the result.
PaymentOptions
: Immutable record for payment details.IPaymentStrategy
: Interface for payment methods.CreditCardPaymentStrategy
,PayPalPaymentStrategy
,MobilePaymentStrategy
: Implementations of payment strategies.PaymentProcessor
: Processes payments using the selected strategy.
This project is licensed under the MIT License.