Exemplo n.º 1
0
 public void Add_digit_to_number()
 {
     var mna = new MockNumberAssembler();
     var sut = new Application(mna, null);
     Assert.AreEqual(2, sut.Assemble_number("23"));
     Assert.AreEqual("23", mna._Digits);
 }
Exemplo n.º 2
0
        public void Execute_operator()
        {
            var mna = new MockNumberAssembler();
            var mc = new MockCalculator();
            var sut = new Application(mna, mc);

            mna._Number = 42;
            Assert.AreEqual(420, sut.Calculate("+"));
            Assert.AreEqual(420, mna.Number);
        }
Exemplo n.º 3
0
 public void Run_application()
 {
     var sut = new Application(new NumberAssembler(), new Calculator());
     Assert.AreEqual(2, sut.Assemble_number("2"));
     Assert.AreEqual(20, sut.Assemble_number("0"));
     Assert.AreEqual(20, sut.Calculate("+"));
     Assert.AreEqual(3, sut.Assemble_number("3"));
     Assert.AreEqual(34, sut.Assemble_number("4"));
     Assert.AreEqual(54, sut.Calculate("*"));
     Assert.AreEqual(4, sut.Assemble_number("4"));
     Assert.AreEqual(40, sut.Assemble_number("0"));
     Assert.AreEqual(2160, sut.Calculate("="));
     Assert.AreEqual(2160, sut.Calculate("+"));
     Assert.AreEqual(2, sut.Assemble_number("2"));
     Assert.AreEqual(20, sut.Assemble_number("0"));
     Assert.AreEqual(2180, sut.Calculate("="));
 }