Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 public void CanEnterDecimalPoints()
 {
     var engine = new Engine();
       engine.Digit(1);
       Assert.AreEqual(1, engine.Value);
       engine.Point();
       Assert.AreEqual(1, engine.Value);
       engine.Digit(2);
       Assert.AreEqual(1.2, engine.Value);
       engine.Digit(3);
       Assert.AreEqual(1.23, engine.Value);
       engine.Plus();
       Assert.AreEqual(1.23, engine.Value);
       engine.Digit(4);
       Assert.AreEqual(4, engine.Value);
       engine.Point();
       Assert.AreEqual(4, engine.Value);
       engine.Digit(5);
       Assert.AreEqual(4.5, engine.Value);
       engine.Digit(6);
       Assert.AreEqual(4.56, engine.Value);
       engine.Equals();
       Assert.AreEqual(5.79, engine.Value);
 }