Exemplo n.º 1
0
 public void BasicPathTests_StaticTests()
 {
     Assert.AreEqual(BasicMath.BasicOperation('+', 4, 7), 11);
     Assert.AreEqual(BasicMath.BasicOperation('-', 15, 18), -3);
     Assert.AreEqual(BasicMath.BasicOperation('*', 5, 5), 25);
     Assert.AreEqual(BasicMath.BasicOperation('/', 49, 7), 7);
 }
Exemplo n.º 2
0
        public void BasicPathTests_RandomTests()
        {
            char[] ops = { '+', '-', '*', '/' };
            Random rnd = new Random();

            for (int i = 0; i < 100; i++)
            {
                double val1 = rnd.Next(1, 999);
                double val2 = rnd.Next(1, 999);

                char op = ops[rnd.Next(1, 4)];

                Assert.AreEqual(BasicMath.BasicOperation(op, val1, val2), getResult(op, val1, val2));
            }
        }