// POST api/calculator public IHttpActionResult Post(Calculate calculate) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(CalculatorLogic.Calculate(calculate))); }
/// <summary> /// Метод, срабатывающий при нажатии на клавишу "=" /// </summary> /// <param name="sender">Текущий объект</param> /// <param name="e">Аргументы события</param> private void ButtonEqually_Click(object sender, EventArgs e) { if (CalculatorLogic.CheckLine(textBox.Text)) { textBox.Text = CalculatorLogic.Calculate(textBox.Text); } else { MessageBox.Show("Выражение введено неверно"); } }
public void Add_Number_Succeed() { Calculate calculate = new Calculate { Next = 10, Total = 10, Operator = "+" }; Calculate result = CalculatorLogic.Calculate(calculate); Assert.AreEqual(calculate.Total, 20); }
public void Divide_Number_Succeed() { Calculate calculate = new Calculate { Next = 2, Total = 10, Operator = "/" }; Calculate result = CalculatorLogic.Calculate(calculate); Assert.AreEqual(calculate.Total, 5); }
public void Multiply_Number_Succeed() { Calculate calculate = new Calculate { Next = 9, Total = 9, Operator = "X" }; Calculate result = CalculatorLogic.Calculate(calculate); Assert.AreEqual(calculate.Total, 81); }
public void Subtract_Number_Succeed() { Calculate calculate = new Calculate { Next = 10, Total = 20, Operator = "-" }; Calculate result = CalculatorLogic.Calculate(calculate); Assert.AreEqual(calculate.Total, 10); }
public ActionResult PackCalculator(CalculatorModel calculator) { CalculatorLogic calculatorLogic = new CalculatorLogic(); CalculatorDTO calculatorDto = new CalculatorDTO(); calculatorDto.CurrentLevel = calculator.CurrentLevel; calculatorDto.Battlepass = calculator.Battlepass; calculatorDto.BoughtPacks = calculator.BoughtPacks; calculatorDto.PlayedSeasons = calculator.PlayedSeasons; calculatorDto.CurrentPack = calculator.CurrentPack; calculatorLogic.Calculate(calculator); return(View(calculator)); }
public void TestCalculate() { Assert.IsTrue(CalculatorLogic.Calculate("") == "Выражение посчитано"); }