public IActionResult Index(CalculatorViewModel viewmodel)
        {
            if (viewmodel.SelectedFilament > 0)
            {
                viewmodel.Calculate();
            }

            return(View(viewmodel));
        }
Example #2
0
        public void TestDivision()
        {
            var calculation = new CalculatorViewModel
            {
                OperandOne = 100,
                OperandTwo = 5,
                Operation  = Operator.Division
            };

            var result = calculation.Calculate();

            Assert.AreEqual(result, 20);
        }
Example #3
0
        public void TestSubtraction()
        {
            var calculation = new CalculatorViewModel
            {
                OperandOne = 40,
                OperandTwo = 10,
                Operation  = Operator.Subtraction
            };

            var result = calculation.Calculate();

            Assert.AreEqual(result, 30);
        }
Example #4
0
        public void TestMultiplication()
        {
            var calculation = new CalculatorViewModel
            {
                OperandOne = 4,
                OperandTwo = 4,
                Operation  = Operator.Multiplication
            };

            var result = calculation.Calculate();

            Assert.AreEqual(result, 16);
        }
Example #5
0
        public void TestAddtion()
        {
            var calculation = new CalculatorViewModel
            {
                OperandOne = 2,
                OperandTwo = 2,
                Operation  = Operator.Addition
            };

            var result = calculation.Calculate();

            Assert.AreEqual(result, 4);
        }