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 TestDiv(double a, double b, double res) { IRPNCalculator c = new RPNCalculator(); Assert.True(c.Size() == 0); c.Push(a); c.Push(b); Assert.True(c.Size() == 2 && c.Top() == b); c.Divide(); Assert.True(c.Size() == 1 && c.Top() == res); }