public void TestOutput()
        {
            BuySellStocks buySell = new BuySellStocks();
            string        file    = @"C:\Computershare Unit Tests\ChallengeSampleDataSet2.txt";
            string        result  = buySell.BestBuySell(file);

            Assert.AreEqual("20(15.79),21(26.19)", result);
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     try
     {
         BuySellStocks buySell = new BuySellStocks();
         // insert the path to stock text file
         Console.WriteLine("Insert path to text file of stock prices here: ");
         string path = Console.ReadLine();
         // call the BestBuySell class which will return the formatted output of the best buy/sell days + prices.
         string result = buySell.BestBuySell(path);
         Console.WriteLine(System.Environment.NewLine + "Optimal buy/sell: " + result + System.Environment.NewLine);
         Console.WriteLine("Please press any key to exit.");
         Console.ReadKey();
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         Console.WriteLine("Please press any key to exit.");
         Console.ReadKey();
     }
 }