public void SimpleCalc_Divide_TwoNegativeDecimalNumbers()
        {
            decimal num1     = -1.1M;
            decimal num2     = -2.2M;
            decimal expected = num1 / num2;

            SimpleCalc calc   = new SimpleCalc();
            decimal    result = calc.divisionFunc(num1, num2);

            Assert.AreEqual(expected, result);
        }
        public void SimpleCalc_Divide_PositiveFirstNumAndNegativeSecondNum()
        {
            decimal num1     = 1;
            decimal num2     = -2;
            decimal expected = num1 / num2;

            SimpleCalc calc   = new SimpleCalc();
            decimal    result = calc.divisionFunc(num1, num2);

            Assert.AreEqual(expected, result);
        }
        public void SimpleCalc_Divide_ZeroFirstNumAndNegativeDecimalSecondNum()
        {
            SimpleCalc calc     = new SimpleCalc();
            decimal    num1     = 0;
            decimal    num2     = -2.2M;
            decimal    expected = num1 / num2;

            decimal result = calc.divisionFunc(num1, num2);

            Assert.AreEqual(expected, result);
        }
        public void SimpleCalc_Divide_TwoPositiveNumbers()
        {
            decimal num1     = 1;
            decimal num2     = 2;
            decimal expected = num1 / num2;

            SimpleCalc calc   = new SimpleCalc();
            decimal    result = calc.divisionFunc(num1, num2);

            Assert.AreEqual(expected, result);
        }
Exemple #5
0
        public string Post([FromForm] decimal leftNumber, [FromForm] decimal rightNumber)
        {
            SimpleCalc calc = new SimpleCalc();
            decimal    result;

            result = calc.divisionFunc(leftNumber, rightNumber);
            if (result == decimal.MinValue)
            {
                return("Error: the rightNumber can't be zero");
            }
            else
            {
                return(result.ToString());
            }
        }