예제 #1
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);
        }
예제 #2
0
        public void TestAdd(long expectedResult, long[] values)
        {
            var  math         = new Calc.Math(optionsProvider.MockOptions());
            long actualResult = math.Add(values);

            Assert.Equal(expectedResult, actualResult);
        }
예제 #3
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);
        }