Newer
Older
using System;
using ATB_ChainPattern.BaseHandlers;
using ATB_ChainPattern.ConcreteHandlers;
namespace ATB_ChainPattern
{
// Client Code
class Program
{
static void Main(string[] args)
{
string inputProduct, inputType = "";
System.Console.WriteLine("Enter a product to analyze (Tesla Stock, Bitcoin): ");
inputProduct = Console.ReadLine();
System.Console.WriteLine("Enter the type of product (Stock, Crypto): ");
inputType = Console.ReadLine();
// Create handlers
var stockHandler = new StockHandlerBase();
// Set up the chain
stockHandler.SetSuccessor(cryptoHandler);
// Client requests analysis of Tesla Stock
stockHandler.AnalyzeProduct("Tesla Stock");
// Client requests analysis of Bitcoin
stockHandler.AnalyzeProduct("Bitcoin");
}
}
}