Beispiel #1
0
        public void Add_GivenValidInputWithLine_DelimiterAndNegativeNumbers_ShouldThrowException(string input, string expectedMessage)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var exception = Assert.Throws <Exception>(() => sut.Add(input));

            //Assert
            Assert.AreEqual(expectedMessage, exception.Message);
        }
Beispiel #2
0
        public void Add_GivenInputWithLine_DelimiterAndNumbersEqualOrBiggerThan1000_ShouldExcludeNumbersEqualOrBiggerThan1000InSum(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }
Beispiel #3
0
        public void Add_GivenInputWithLine__And_ManyDelimiters_ShouldRetrunSumOfNumbersProvided(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }
Beispiel #4
0
        public void Add_GivenValidInputWithLineAndDelimiter_ShouldReturnSum(string input, int expected)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void Add_GivenInValidInput_ShouldReturnZero(string input, int expected)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Add_GivenInputWithNumbersGreaterThan1000_ShouldNotIncludeInSum(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }
        public void Add_GivenNegativeInput_ShouldThrowException(string input, string expectedMessage)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = Assert.Throws <Exception>(() => sut.Add(input));

            //Assert
            Assert.AreEqual(expectedMessage, actual.Message);
        }
        public void Add_GivenInputWithNewLineAndDelimiter_ShouldReturnSumOfNumbersFromInput(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }
        public void Add_GivenInputWithDifferentDelimiters_ShouldReturnSumOfInputs(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

            //Act
            var actual = sut.Add(input);

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }