public IActionResult Add(CalcModel model) { var result = _calcService.Add(Int32.Parse(model.num1), Int32.Parse(model.num2)); model.result = result; return(View(model)); }
public ObjectResult Add([FromQuery] double num1, [FromQuery] double num2) { var calcResult = _service.Add(num1, num2); string decorated_result = _calcResults.Decorate(num1, num2, calcResult, "Add"); return(Ok(decorated_result)); }
public ActionResult AddOption(CalcModel Model) { var result = new CalcResultModel(); CalcService Service = new CalcService(); result.result = Service.Add(Model); return(Ok(result)); }
public void AddValidationTest() { var service = new CalcService(new LoggerMock()); Assert.Throws <ApplicationException>(() => { service.Add(new[] { 1, float.PositiveInfinity }); }); }
public void TestMethod1() { int x = 10; int y = 15; //int z = x + y; CalcService calcService = new CalcService(); int result = calcService.Add(x, y); Assert.AreEqual(15, result); }
public IActionResult Add([FromHeader] int n1, [FromHeader] int n2) { try { CalcService calcService = new CalcService(); int result = calcService.Add(n1, n2); return(Ok(result)); } catch (Exception ex) { return(NotFound(ex.Message)); } }
public void start(BundleContext context) { ServiceReference reference = context.getServiceReference(typeof(CalcService).FullName); if (reference == null) { log.Warn("未找到服务引用!!!"); return; } int x = 4324; int y = 7833; CalcService calcService = context.getService(reference) as CalcService; log.Info(String.Format("调用服务测试:{0} + {1} = {2}", x, y, calcService.Add(x, y))); }
void calcResult(char activeOp) { switch (activeOp) { case '=': result = currentVal; break; case '+': //result = storedVal + currentVal; result = calcService.Add(storedVal, currentVal); break; case '-': result = storedVal - currentVal; break; case 'x': result = storedVal * currentVal; break; case '÷': if (currentVal != 0) { result = storedVal / currentVal; } else { errorDisplayed = true; digitLabel.text = "ERROR"; } break; default: Debug.Log("unknown: " + activeOp); break; } currentVal = result; updateDigitLabel(); }
public IActionResult Add(string a, string b) { var result = _calcService.Add(Int32.Parse(a), Int32.Parse(b)); return(Ok(result)); }