Пример #1
0
        public static void Main(string[] args)
        {
            StartUp();

            Console.WriteLine("Buy low, sell high!");
            Console.WriteLine("Enter the stock price source:");

            var source = "";

            while (source.Length == 0 && !File.Exists(source))
            {
                source = Console.ReadLine();

                if (!File.Exists(source))
                {
                    Console.WriteLine("Please enter a valid source:");
                }
            }

            var sourceOps = new SourceOperations();

            var stockPrices = sourceOps.GetStockPrices(source);

            var stockPriceOps = new StockPriceOperations();

            var bestTrade = stockPriceOps.GetBestTrade(stockPrices);

            if (bestTrade == null)
            {
                Console.WriteLine("ERROR: unable to calculate the best trade for the given stock prices!");
            }
            else
            {
                Console.WriteLine(bestTrade.ToString());
            }
        }
Пример #2
0
 public void Setup()
 {
     _stockPriceOperations = new StockPriceOperations(new NullLogger <StockPriceOperations>());
 }