public void RpnEngine_CalculateLoop_Failure(params string[] operation) { var rpnEngine = new RpnEngine(); var _stack = new Stack <decimal>(); var expectedValue = decimal.Parse(operation[3]); string[] rpnTokens = new string[3]; for (int i = 0; i < 3; ++i) { rpnTokens[i] = operation[i]; } Action calculation = () => rpnEngine.CalculateLoop(rpnTokens, _stack); calculation.Should().Throw <ArgumentException>(); }
public void RpnEngine_CalculateLoop_Success(params string[] operation) { var rpnEngine = new RpnEngine(); var _stack = new Stack <decimal>(); var expectedValue = decimal.Parse(operation[3]); string[] rpnTokens = new string[3]; for (int i = 0; i < 3; ++i) { rpnTokens[i] = operation[i]; } var calculation = rpnEngine.CalculateLoop(rpnTokens, _stack); calculation.Should().Be(expectedValue); }