public void FindNonHypotenuse() { var side2 = Pythagorean.FindNonHypotenuse(3, 5); // Using pythagorean theorem, the other side should be 4 Assert.AreEqual(4, side2); }
public void FindNonHypotenuseValidateInputs() { var error = false; try { // Make sure side 1 is valid Pythagorean.FindNonHypotenuse(0, 2); error = true; } catch { // ignored } try { // Make sure hypotenuse is valid Pythagorean.FindNonHypotenuse(2, 0); error = true; } catch { // ignored } try { // Make sure hypotenuse is > side 1 Pythagorean.FindNonHypotenuse(2, 2); error = true; } catch { // ignored } Assert.IsFalse(error, "We should have thrown errors above"); }