public void throw_exception_if_income_not_larger_than_0() { //arrange var service = new CalculateService(); // assert Assert.Catch <ArgumentException>(() => service.Calculate(_taxRate, -0.1m)); Assert.Catch <ArgumentException>(() => service.Calculate(_taxRate, 0m)); }
public void Shoul_Calculate_When_Pass_Null() { var instance = new CalculateService(); int expectedResult = instance.Calculate(null); Assert.That(expectedResult, Is.EqualTo(0)); }
public void Should_Calculate_More_Then_One_Digit_Format_When_Pass_String_Any_Symbol_Separated() { var instance = new CalculateService(); int expectedResult = instance.Calculate("12,34"); Assert.That(expectedResult, Is.EqualTo(46)); }
public void Should_Calculate_When_Pass_String_Any_Symbol_Separated() { var instance = new CalculateService(); int expectedResult = instance.Calculate("1;2,3+4"); Assert.That(expectedResult, Is.EqualTo(10)); }
public void calculate_tax_200000() { //arrange var service = new CalculateService(); // act var result = service.Calculate(_taxRate, 200000m); // assert Assert.IsNotEmpty(result.Description); Assert.AreEqual(200000m, result.TaxableIncome); Assert.AreEqual(67426.16m, result.TotalAmount); }
public void calculate_tax_19404() { //arrange var service = new CalculateService(); // act var result = service.Calculate(_taxRate, 19404.004m); // assert Assert.IsNotEmpty(result.Description); Assert.AreEqual(19404.004m, result.TaxableIncome); Assert.AreEqual(228.76076m, result.TotalAmount); }
static void Main(string[] args) { var calculateService = new CalculateService(); string formulaTemple = "{{arg.a}}+{{arg.b}}"; var arg = new ParaModel() { a = 1, b = 2 }; var arg2 = new ParaModel() { a = 1, b = 2 }; var result = calculateService.Calculate(formulaTemple, () => new { arg, arg2 }); Console.WriteLine(result); }
public void WhenDividByZeroGetResult() { CalculateService calcService = new CalculateService(); string result = calcService.Calculate("4/2"); }
public double Post([FromBody] CalculateViewModel calculateViewModel) { var result = _calculateService.Calculate(calculateViewModel.Formula, () => new { calculateViewModel.para }); return(result); }
public CalculationsViewModel Calculate(DateTime startDate, DateTime endDate) { return(_service.Calculate(startDate, endDate)); }