private static void RunLoop(Calculator calculator) { while (true) { Console.ForegroundColor = ConsoleColor.Gray; var line = Console.ReadLine(); if (line == null) break; var args = SplitInput(line); var result = calculator.Calculate(args); Console.ForegroundColor = result.HasValue ? ConsoleColor.Green : ConsoleColor.Red; Console.WriteLine("> " + result); } }
public string[] SplitInput(string input) { return(Calculator.SplitInput(input)); }
public void SetUp() { calc = new Calculator(); }
private static void Main() { Calculator calculator = new Calculator(); RunLoop(calculator); }