public IActionResult Index(CalculatorViewModel viewmodel) { if (viewmodel.SelectedFilament > 0) { viewmodel.Calculate(); } return(View(viewmodel)); }
public void TestDivision() { var calculation = new CalculatorViewModel { OperandOne = 100, OperandTwo = 5, Operation = Operator.Division }; var result = calculation.Calculate(); Assert.AreEqual(result, 20); }
public void TestSubtraction() { var calculation = new CalculatorViewModel { OperandOne = 40, OperandTwo = 10, Operation = Operator.Subtraction }; var result = calculation.Calculate(); Assert.AreEqual(result, 30); }
public void TestMultiplication() { var calculation = new CalculatorViewModel { OperandOne = 4, OperandTwo = 4, Operation = Operator.Multiplication }; var result = calculation.Calculate(); Assert.AreEqual(result, 16); }
public void TestAddtion() { var calculation = new CalculatorViewModel { OperandOne = 2, OperandTwo = 2, Operation = Operator.Addition }; var result = calculation.Calculate(); Assert.AreEqual(result, 4); }