public async Task Calculate_ShouldThrowDivideByZeroException_WhenDividingByZero() { ICalculatorAggregate calculator = new CalculatorAggregate(); await Assert.ThrowsExceptionAsync <DivideByZeroException>(() => calculator.Calculate( new EquationModel { Param1 = 5, Param2 = 0, Operation = "/" })); }
public async Task Calculate_ShouldReturnCorrectResult_WhenUsingBasicOperations(double param1, double param2, string op, double expectedResult) { ICalculatorAggregate calculator = new CalculatorAggregate(); var result = await calculator.Calculate( new EquationModel { Param1 = param1, Param2 = param2, Operation = op }); Assert.AreEqual <double>(expectedResult, result); }