public void CatchException_DivideBy0()
        {
            decimal result = 0;
            string  input  = "3d0";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);
        }
Exemple #2
0
        public void Pass_990For3c4d2aee2a4c41fc4f()
        {
            decimal result = 0;
            string  input  = "3c4d2aee2a4c41fc4f";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 990);
        }
Exemple #3
0
        public void Pass_235For3ae4c66fb32()
        {
            decimal result = 0;
            string  input  = "3ae4c66fb32";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 235);
        }
Exemple #4
0
        public void Pass_14208For500a10b66c32()
        {
            decimal result = 0;
            string  input  = "500a10b66c32";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 14208);
        }
Exemple #5
0
        public void Pass_17For32a2d2()
        {
            decimal result = 0;
            string  input  = "32a2d2";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 17);
        }
        public void Pass_NegativeTotal()
        {
            decimal result = 0;
            string  input  = "3b5";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, -2);
        }
        public void Pass_DoubleBrackets()
        {
            decimal result = 0;
            string  input  = "3ae1a2fbe3a1fa2";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 4);
        }
        public void Pass_NestedBrackets()
        {
            decimal result = 0;
            string  input  = "3a2ce1a2ce3b1fb2f";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 20);
        }
        public void Pass_SingleBrackets()
        {
            decimal result = 0;
            string  input  = "2a1ae3a2fb1";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 7);
        }
        public void Pass_Subtraction()
        {
            decimal result = 0;
            string  input  = "5b2";

            input = "e" + input + "f";

            IParseMaths parseMaths = new ParseMaths();

            result = parseMaths.CalculateExpression(input);

            Assert.AreEqual(result, 3);
        }
Exemple #11
0
        static void Main(string[] args)
        {
            string userInput;

            //Start Program
            IGetInput getInput = new GetInput();

            userInput = getInput.ReadInput();
            while (getInput.ValidateInput(userInput) == false)
            {
                userInput = getInput.ReadInput();
            }

            //got here so input must be valid
            IParseMaths parseMaths = new ParseMaths();

            Console.WriteLine(parseMaths.CalculateExpression(userInput));

            //Keep Console Box open
            Console.Write("Press any key to exit");
            Console.ReadLine();
        }