public void Division(decimal x, decimal y, decimal result, bool succeeds = true) { var calculation = new Divide(x, y); if (succeeds) { var actual = calculation.Calculate(); Assert.Equal <decimal>(result, actual); } else { Assert.Throws <DivideByZeroException>(() => calculation.Calculate()); } }
public void CalculateDivide(double firstValue, double secondValue, double expected) { ITwoArgumentsCalculate calculator = new Divide(); double result = calculator.Calculate(firstValue, secondValue); Assert.AreEqual(expected, result); }
public void CalculateTest(double firstValue, double secondValue, double expected) { var calculator = new Divide(); var actualResult = calculator.Calculate(firstValue, secondValue); Assert.AreEqual(expected, actualResult); }
public void TestDivide(double firstArgument, double secondArgument, double output) { var calculator = new Divide(); var testResult = calculator.Calculate(firstArgument, secondArgument); Assert.AreEqual(output, testResult, 0.0000001); }
private void CalculateAndPrintResult(double firstNumber, string @operator, double secondNumber) { ICalculator calculator = null; switch (@operator) { case "+": calculator = new Add(firstNumber, secondNumber); break; case "-": calculator = new Subtract(firstNumber, secondNumber); break; case "*": calculator = new Multiply(firstNumber, secondNumber); break; case "/": calculator = new Divide(firstNumber, secondNumber); break; } writer.Write($"The result is: {calculator.Calculate():F2}"); }
public void DivideTest(double firstArgument, double secondArgument, double result) { var calculator = new Divide(); var testResult = calculator.Calculate(firstArgument, secondArgument); Assert.AreEqual(result, testResult); }
public void Calculate(double firstInput, double secondInput, double output) { var calculator = new Divide(); var testResult = calculator.Calculate(firstInput, secondInput); var result = output; Assert.AreEqual(testResult, result); }
public void Calculate(double firstInput, double secondInput, double output) { var calculator = new Divide(); var testResult = calculator.Calculate(firstInput, secondInput); var result = output; Assert.AreEqual(testResult, result); }
public void DivideTest() { Operations operation = new Divide(); operation.Operand1 = 3; try { operation.Operand2 = 0; operation.Calculate(); Assert.Fail(); } catch (NullReferenceException ex) { Assert.That(ex.Message, Is.EqualTo("You cannot devide on 0")); } }
public void DivideTestNullException() { Operations operation = new Divide(); operation.Operand1 = 3; try { operation.Operand2 = 0; operation.Calculate(); } catch { NullReferenceException ex = Assert.Throws <NullReferenceException>( delegate { throw new NullReferenceException("You cannot devide on 0"); }); Assert.That(ex.Message, Is.EqualTo("You cannot devide on 0")); } }
public void DivideZeroTest() { var calculator = new Divide(); calculator.Calculate(4, 0); }
public void DivisionByZero() { var calculator = new Divide(); calculator.Calculate(22, 0); }
public void DivisionByZeroTests() { var calculator = new Divide(); var result = calculator.Calculate(4, 0); }
public void DivisionByZeroTests() { var calculator = new Divide(); var result = calculator.Calculate(4, 0); }