Exemple #1
0
        public void FormatExceptionTest(string invalidInput, string negativeNumbers)
        {
            // Arrange
            var calculatorAddService = new CalculatorAddService();

            // Act
            var mockException = Assert.Throws <FormatException>(() => calculatorAddService.Execute(invalidInput));

            // Assert
            Assert.Equal("Negative numbers are invalid: " + negativeNumbers, mockException.Message);
        }
Exemple #2
0
        public void CalculatorAddNegativeTest(string inputString, string expectedOutput)
        {
            // Arrange
            var calculatorAddService = new CalculatorAddService();

            // Act - pass in optional parameters for negatives and max value
            var actualOutput = calculatorAddService.Execute(inputString, true, 5000);

            // Assert
            Assert.Equal(expectedOutput, actualOutput);
        }
Exemple #3
0
        public void CalculatorAddTest(string inputString, string expectedOutput)
        {
            // Arrange
            var calculatorAddService = new CalculatorAddService();

            // Act
            var actualOutput = calculatorAddService.Execute(inputString);

            // Assert
            Assert.Equal(expectedOutput, actualOutput);
        }