public void ArgumentsExceedLimitsOnSubstract() { Calculator calculator = new Calculator(-100, 100); try { calculator.Substract(calculator.UpperLimit + 1, calculator.LowerLimit - 1); Assert.Fail("This should fail: arguments exceed limits"); } catch (OverflowException) { // Ok, the SUT works as expected } }
public void SubstractReturningNegative() { Calculator calculator = new Calculator(-100,100); int result = calculator.Substract(3, 5); Assert.AreEqual(-2, result); }
public void Substract() { Calculator calculator = new Calculator(-100,100); int result = calculator.Substract(5, 3); Assert.AreEqual(2, result); }
public void SubstractSettingLimitValues() { Calculator calculator = new Calculator(-100, 100); try { int result = calculator.Substract(10, 150); Assert.Fail("Exception is not being thrown when " + "exceeding lower limit"); } catch (OverflowException) { // Ok, the SUT works as expected } }