public void TestSolver2() { int limit = 10000; // 10 thousand int expected = 18228; Euler36cSolver euler36Solver = new Euler36cSolver(); long total = euler36Solver.Solve(limit); Assert.AreEqual(expected, total, "Euler36cSolver produced the wrong result"); }
public void TestSolver() { int limit = 1000000; // 1 million int expected = 872187; Euler36cSolver euler36Solver = new Euler36cSolver(); long total = euler36Solver.Solve(limit); Assert.AreEqual(expected, total, "Euler36cSolver produced the wrong result"); }
public void TestSolverNegativeNumber() { try { int limit = -1000; Euler36cSolver euler36Solver = new Euler36cSolver(); long total = euler36Solver.Solve(limit); Assert.Fail(); // if Solve() doesn't throw an exception, the test has failed } catch (ArgumentException e) { String expectedMessage = "Euler36Solver.Solve cannot solve for numbers less than 10"; Assert.AreEqual(expectedMessage, e.Message); } catch (Exception) { // not the right kind of exception Assert.Fail(); } }