public void AddTest(int number1, int number2, int expected) { CalculatorBL calculator = new CalculatorBL(); var result = calculator.Add(number1, number2); Assert.Equal(expected, result); }
public SqrtResult Sqrt([FromBody] SqrtRequest sqrtRequest) { var headers = this.Request.Headers.ToList(); string tracking_ID = headers[headers.Count - 1].Value.First().ToString(); return(CalculatorBL.Sqrt(sqrtRequest, tracking_ID)); }
public DivtResult Div([FromBody] DivtRequest divtRequest) { var headers = this.Request.Headers.ToList(); string tracking_ID = headers[headers.Count - 1].Value.First().ToString(); return(CalculatorBL.Div(divtRequest, tracking_ID)); }
public AddResult Add([FromBody] AddRequest addRequest) { var headers = this.Request.Headers.ToList(); string tracking_ID = headers[headers.Count - 1].Value.First().ToString(); return(CalculatorBL.Add(addRequest, tracking_ID)); }
public void AddTest() { var number1 = 10; var number2 = 20; var expected = 30; CalculatorBL calculator = new CalculatorBL(); var result = calculator.Add(number1, number2); Assert.Equal(expected, result); }
public IActionResult GetPremiumValue(CalculatorModel model) { List <ConfigurationData> lstData = new List <ConfigurationData>(); try { using (ICalculatorBL CalculatorBL = new CalculatorBL()) { //Load configuration data to do calculation lstData = CalculatorBL.LoadConfigurationData(); //Evaluate parameters (BirthDate, state and age) with data var vResult = lstData.FirstOrDefault(t => { if (model.State == Enums.StateName.cStateNY || model.State == Enums.StateName.cStateAL) { if (t.State == model.State && t.BirthMonth == model.BirthDate.Month && (t.StartAge <= model.Age && t.EndAge >= model.Age)) { return(true); } else if (t.State == model.State && t.BirthMonth == Enums.ValidationType.cAllMonths && t.StartAge <= model.Age && t.EndAge >= model.Age) { return(true); } else { return(false); } } else if (model.State == Enums.StateName.cStateAK) { if (t.State == model.State && t.BirthMonth == model.BirthDate.Month && (t.StartAge <= model.Age && t.EndAge >= model.Age)) { return(true); } else if (t.State == model.State && t.BirthMonth == model.BirthDate.Month && t.StartAge <= model.Age) { return(true); } else if (t.State == model.State && t.BirthMonth == Enums.ValidationType.cAllMonths && t.StartAge <= model.Age && t.EndAge >= model.Age) { return(true); } else { return(false); } } else if (t.State == Enums.ValidationType.cAllStates && t.BirthMonth == Enums.ValidationType.cAllMonths && t.StartAge <= model.Age && t.EndAge >= model.Age) { return(true); } else { return(false); } }); return(Ok(vResult)); } } catch (Exception ex) { return(StatusCode(500, ex)); } }
public void FailingAddTest() { CalculatorBL calculator = new CalculatorBL(); Assert.Equal(5, calculator.Add(2, 2)); }
public List <Operations> Query([FromBody] string id) { return(CalculatorBL.Query(id)); }