public void TestDivide(long expectedResult, long[] values) { var math = new Calc.Math(optionsProvider.MockOptions()); long actualResult = math.Divide(values); Assert.Equal(expectedResult, actualResult); }
public void TestValidateShouldIgnoreLargeNumbers(int largestNumber, long[] numbers, long expectedResult) { var math = new Calc.Math(optionsProvider.MockOptions(largestNumber: largestNumber)); var actualResult = math.Add(numbers); Assert.Equal(expectedResult, actualResult); }
public void TestValidateMaximumNumberThrowsException(int?maximumNumbers, long[] numbers) { var math = new Calc.Math(optionsProvider.MockOptions(maximumNumbers: maximumNumbers)); var exception = Record.Exception(() => math.ValidateNumbers(numbers)); Assert.IsType <Calc.MaximumNumberExeption>(exception); }
public void TestShouldDenyNegativeNumbers(string s, long[] numbers, long[] expectedErrors) { var math = new Calc.Math(optionsProvider.MockOptions(shouldDenyNegative: true)); var exception = Record.Exception(() => math.Add(numbers)); Assert.IsType <NegativeNumbersException>(exception); Assert.Equal(expectedErrors, ((NegativeNumbersException)exception).NegativeNumbers); }