コード例 #1
0
        public void TestDivide(long expectedResult, long[] values)
        {
            var  math         = new Calc.Math(optionsProvider.MockOptions());
            long actualResult = math.Divide(values);

            Assert.Equal(expectedResult, actualResult);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }