コード例 #1
0
ファイル: Addition.cs プロジェクト: zc128/BasicCalculatorApp
        public string Post([FromForm] decimal leftNumber, [FromForm] decimal rightNumber)
        {
            SimpleCalc calc = new SimpleCalc();
            decimal    result;

            result = calc.additionFunc(leftNumber, rightNumber);
            return(result.ToString());
        }
コード例 #2
0
        public void SimpleCalc_Add_TwoPositiveNumbers()
        {
            decimal num1     = 1;
            decimal num2     = 2;
            decimal expected = num1 + num2;

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

            Assert.AreEqual(expected, result);
        }
コード例 #3
0
        public void SimpleCalc_Add_ZeroFirstNumAndNegativeSecondNum()
        {
            decimal num1     = 0;
            decimal num2     = -2;
            decimal expected = num1 + num2;

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

            Assert.AreEqual(expected, result);
        }
コード例 #4
0
        public void SimpleCalc_Add_TwoNegativeDecimalNumbers()
        {
            decimal num1     = -1.1M;
            decimal num2     = -2.2M;
            decimal expected = num1 + num2;

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

            Assert.AreEqual(expected, result);
        }