public void TryParse_ShouldFail(string given) { var m = new MathEngine(); int actual; bool parseResults = m.TryParse(given, out actual); Assert.False(parseResults, "TryParse should fail."); }
public void TryParse_ShouldSucceed(string given, int expected) { var m = new MathEngine(); int actual; bool parseResults = m.TryParse(given, out actual); Assert.True(parseResults, "TryParse should succeed."); Assert.Equal(expected, actual); }
static void Main(string[] args) { var problem = String.Join("", args); Console.WriteLine($"problem: {problem}"); var m = new MathEngine(); int answer; if (m.TryParse(problem, out answer)) { Console.WriteLine($"answer: {answer}"); } else { Console.WriteLine($"Error parsing problem."); } }