public void TestAddNumbers(int x, int y, int expectedResult) { var cs = new CalcService(); var result = cs.AddNumbers(x, y); Assert.Equal(expectedResult, result); }
public ActionResult Add(CalcViewModel model) { var cs = new CalcService(); var result = cs.AddNumbers(model.Number1, model.Number2); model.Result = result; return(View("Process", model)); }
public void TestAddNumbers(int x, int y, int expectedResult) { // 1. Arrange var cs = new CalcService(); // 2. Act var result = cs.AddNumbers(x, y); // 3. Assert Assert.Equal(expectedResult, result); }
public ActionResult ProcessWithService(CalcViewModel model) { bool isSuccess = ExternalService.DoGreatThings(); if (isSuccess) { var cs = new CalcService(); var result = cs.AddNumbers(model.Number1, model.Number2); model.Result = result; return(View(model)); } { throw new Exception(); } }