예제 #1
0
        public void Add_GivenInputGreaterThan1000_ShouldNotAddToSumOfInputs(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

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

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }
예제 #2
0
        public void Add_GivenInputWithNewLineAndDelimiter_ShouldReturnSum(string input, int expectedSum)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

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

            //Assert
            Assert.AreEqual(expectedSum, actual);
        }
예제 #3
0
        public void Add_GivenNegativeInput_ShouldThrowException(string input, string expectedMsg)
        {
            //Arrange
            var sut = new StringCalculatorLogic();

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

            //Assert
            Assert.AreEqual(expectedMsg, actual.Message);
        }
예제 #4
0
        public void Add_GivenInvalidInput_ShouldReturnZero(string input)
        {
            //Arrange
            var expected = 0;
            var sut      = new StringCalculatorLogic();

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

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