public void ConstantCanAddMultipleConstantsToList()
 {
     Constant myConstant = new Constant();
     myConstant.addConst("a", 5);
     myConstant.addConst("b", 8);
     Assert.AreEqual(5, myConstant.getNum("a"));
     Assert.AreEqual(8, myConstant.getNum("b"));
 }
 public void ConstantCanAdd()
 {
     Constant newConstant = new Constant();
     newConstant.addConst("a", 2);
     Evaluate twoPlusThree = new Evaluate("a + 3", newConstant);
     Assert.AreEqual(5, twoPlusThree.doMath());
 }
        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 ConstantCannotReturnNonexistantNum()
 {
     Constant myConstant = new Constant();
     myConstant.addConst("a", 5);
     myConstant.getNum("b");
 }
 public void ConstantCanNotAddSameLetterTwice()
 {
     Constant myConstant = new Constant();
     myConstant.addConst("a", 5);
     myConstant.addConst("a", 8);
 }
 public void ConstantCanAddConstantToList()
 {
     Constant myConstant = new Constant();
     myConstant.addConst("a", 5);
     Assert.AreEqual(5, myConstant.getNum("a"));
 }