public void CanAddAndSubtract() { var engine = new Engine(); Assert.AreEqual(0, engine.Value); engine.Digit(1); Assert.AreEqual(1, engine.Value); engine.Plus(); Assert.AreEqual(1, engine.Value); engine.Digit(2); Assert.AreEqual(2, engine.Value); engine.Plus(); Assert.AreEqual(3, engine.Value); engine.Digit(3); Assert.AreEqual(3, engine.Value); engine.Minus(); Assert.AreEqual(6, engine.Value); engine.Digit(4); Assert.AreEqual(4, engine.Value); engine.Minus(); Assert.AreEqual(2, engine.Value); engine.Digit(5); Assert.AreEqual(5, engine.Value); engine.Equals(); Assert.AreEqual(-3, engine.Value); }
public void CanSubtract() { var engine = new Engine(); engine.Digit(1); engine.Minus(); engine.Digit(2); engine.Equals(); Assert.AreEqual(-1, engine.Value); }
public void CanPlusAfterNegate() { var engine = new Engine(); engine.Minus(); engine.Plus(); engine.Digit(5); engine.Minus(); engine.Digit(3); engine.Equals(); Assert.AreEqual(2, engine.Value); }
public void CanNegate() { var engine = new Engine(); engine.Minus(); engine.Digit(1); Assert.AreEqual(-1, engine.Value); }
public void CanEnterNegativeMultiDigitNumbers() { var engine = new Engine(); engine.Minus(); Assert.AreEqual(0, engine.Value); engine.Digit(1); Assert.AreEqual(-1, engine.Value); engine.Digit(2); Assert.AreEqual(-12, engine.Value); engine.Digit(3); Assert.AreEqual(-123, engine.Value); engine.Plus(); Assert.AreEqual(-123, engine.Value); engine.Minus(); Assert.AreEqual(-123, engine.Value); engine.Digit(4); Assert.AreEqual(-4, engine.Value); engine.Digit(5); Assert.AreEqual(-45, engine.Value); engine.Digit(6); Assert.AreEqual(-456, engine.Value); engine.Equals(); Assert.AreEqual(-579, engine.Value); }
public void CanEnterNegativeDecimals() { var engine = new Engine(); engine.Minus(); engine.Point(); engine.Digit(1); Assert.AreEqual(-0.1, engine.Value); engine.Digit(2); Assert.AreEqual(-0.12, engine.Value); engine.Times(); Assert.AreEqual(-0.12, engine.Value); engine.Digit(3); engine.Equals(); Assert.AreEqual(-0.36, engine.Value); }