public void TestAdd(double a, double b, double res) { IRPNCalculator c = new RPNCalculator(); c.Push(a); c.Push(b); c.Add(); Assert.True(c.Top() == res); }
public void TestDivZero() { IRPNCalculator cal = new RPNCalculator(); Assert.True(cal.Size() == 0); cal.Push(0); cal.Push(5); Assert.Throws <ArgumentException>(() => cal.Divide()); cal.Add(); Assert.True(cal.Size() == 1); }
public void TestMoreMaths(double a, double b, double c, double res) { IRPNCalculator cal = new RPNCalculator(); Assert.True(cal.Size() == 0); cal.Push(a); cal.Push(b); cal.Push(c); Assert.True(cal.Size() == 3 && cal.Top() == 5); cal.Add(); cal.Multiply(); Assert.True(cal.Top() == res && cal.Size() == 1); }