public int EvaluateInput(string input)
 {
     Parse parse = new Parse();
     Add add_input = new Add();
     Subtract subtract_input = new Subtract();
     Multiply multiply_input = new Multiply();
     Divide divide_input = new Divide();
     Modulo modulo_input = new Modulo();
     if (parse.OperatorInput(input) == '+')
     {
         return add_input.AddItems(input);
     }
     if (parse.OperatorInput(input) == '-')
     {
         return subtract_input.SubtractItems(input);
     }
     if (parse.OperatorInput(input) == '*')
     {
         return multiply_input.MultiplyItems(input);
     }
     if (parse.OperatorInput(input) == '/')
     {
         return divide_input.DivideItems(input);
     }
     if (parse.OperatorInput(input) == '%')
     {
         return modulo_input.ModuloItems(input);
     }
     throw new FormatException();
 }
Beispiel #2
0
 public void AddWorks()
 {
     string mock_input = "1 + 2";
     Add items = new Add();
     Assert.AreEqual(3, items.AddItems(mock_input));
 }