public void AddWithDifferentArguments() { _calculator = new Calculator(); _calcProxy = new CalcProxy(new Validator(-10, 10), _calculator); int result = _calcProxy.BinaryOperation(_calculator.Add, 2, 5); Assert.AreEqual(7, result); }
public void Substract() { _calculator = new Calculator(); _calcProxy = new CalcProxy(new Validator(-10, 10), _calculator); int result = _calcProxy.BinaryOperation(_calculator.Substract, 5, 3); Assert.AreEqual(2, result); }
public void Add() { _calculator = new Calculator(); _calcProxy = new CalcProxy(new Validator(-10, 10), _calculator); int result = _calcProxy.BinaryOperation(_calculator.Add, 5, 2); Assert.AreEqual(7, result); }
public void ArgumentsExceedLimitsInverse() { _calculator = new Calculator(); CalcProxy calcProxyWithLimits = new CalcProxy(new Validator(-10, 10), _calculator); try { calcProxyWithLimits.BinaryOperation(_calculator.Add, -30, -50); Assert.Fail("This should fail as arguments exceed both limits"); } catch (OverflowException) { // Ok, this works } }
public override int Resolve(int a, int b) { return(CalcProxy.BinaryOperation(CalcProxy.Calculator.Multiply, a, b)); }
public void ValidateResultExceedingLowerLimit() { _calculator = new Calculator(); CalcProxy calcProxyWithLimits = new CalcProxy(new Validator(-10, 10), _calculator); try { calcProxyWithLimits.BinaryOperation(_calculator.Add, -20, -1); Assert.Fail("This should fail as result exceed upper limit"); } catch (OverflowException) { // Ok, this works } }
public void SubstractReturningNegative() { _calculator = new Calculator(); _calcProxy = new CalcProxy(new Validator(-10, 10), _calculator); int result = _calcProxy.BinaryOperation(_calculator.Substract, 3, 5); Assert.AreEqual(-2, result); }
public override int Resolve(int a, int b) { return(CalcProxy.BinaryOperation(CalcProxy.Calculator.Substract, a, b)); }