static void Main(string[] args)
        {
            int count = 0;
            Constant currentConstant = new Constant();
            Evaluate expression;

            while (true)
            {
                Console.Write("[{0}]> ", count);
                string input = Console.ReadLine();
                expression = new Evaluate(input, currentConstant);
                if (input.ToLower() == "exit" || input.ToLower() == "quit")
                {
                    break;
                }
                else if (input.IndexOf("=")> -1)
                {
                    //set variable

                    Parse addConstant = new Parse(input, currentConstant);
                    addConstant.setOperatorIndex();
                    currentConstant.addConst(addConstant.StringFirst(), addConstant.secondNum());
                    // = saved 'x' as '3'
                    Console.WriteLine("= saved '" + addConstant.StringFirst() + "' as '" + addConstant.secondNum() + "'");

                }
                else
                {
                    int answer = expression.doMath();
                    Console.WriteLine("   = {0}", answer);
                    count++;

                }
            }
        }
 public void ConstantCanAdd()
 {
     Constant newConstant = new Constant();
     newConstant.addConst("a", 2);
     Evaluate twoPlusThree = new Evaluate("a + 3", newConstant);
     Assert.AreEqual(5, twoPlusThree.doMath());
 }
 public void EvaluateCanSubtract()
 {
     Evaluate twoPlusThree = new Evaluate("2 - 3");
     Assert.AreEqual(-1, twoPlusThree.doMath());
 }
 public void EvaluateCanMultiply()
 {
     Evaluate twoPlusThree = new Evaluate("2 * 3");
     Assert.AreEqual(6, twoPlusThree.doMath());
 }
 public void EvaluateCanModulus()
 {
     Evaluate twelveModThree = new Evaluate("12 % 3");
     Assert.AreEqual(0, twelveModThree.doMath());
 }
 public void EvaluateCanAddWithNegativeNumbers()
 {
     Evaluate twoPlusThree = new Evaluate("-2+-3");
     Assert.AreEqual(-5, twoPlusThree.doMath());
 }
 public void EvaluateCanAdd()
 {
     Evaluate twoPlusThree = new Evaluate("2 + 3");
     Assert.AreEqual(5, twoPlusThree.doMath());
 }