public void StringCalculator_inputAnyNumbersAsStringWithCustomDelimiter_returnsSum(string input, int expected) { //Given StringCalculator stringCalculator = new StringCalculator(); //When int actual = stringCalculator.Add(input); //Then Assert.Equal(expected, actual); }
public void StringCalculator_InputMultipleDelimitersWhereNumberCanBePartOfDelimiter_returnsSum(string input, int expected) { //Given StringCalculator stringCalculator = new StringCalculator(); //When int actual = stringCalculator.Add(input); //Then Assert.Equal(expected, actual); }
public void StringCalculator_inputMultipleDelimitersLongerThanOneCharacter_returnsSum(string input, int expected) { //Given StringCalculator stringCalculator = new StringCalculator(); //When int actual = stringCalculator.Add(input); //Then Assert.Equal(expected, actual); }
public void StringCalculator_inputNumbersGreaterThanOrEqualTo1000_ignored(string input, int expected) { //Given StringCalculator stringCalculator = new StringCalculator(); //When int actual = stringCalculator.Add(input); //Then Assert.Equal(expected, actual); }
public void InputShouldReturnExpectedOutput(string expectedInput, string expectedOutput) { var stringSum = new StringCalculator(); Assert.That(stringSum.Add(expectedInput), Is.EqualTo(expectedOutput)); }
public void StringCalculator_inputNegativeNumbersThrowException(string input, string output) { //Given StringCalculator stringCalculator = new StringCalculator(); Exception ex = Assert.Throws <NegativeNumbersNotAllowedException>(() => stringCalculator.Add(input)); //When Assert.Equal($"Negatives not allowed: {output}", ex.Message); }
public void StringCalculator_InputCustomDelimiterWithNumberOnEdgeOfDelimiter_ThrowsNumbersCannotBeEdgeOfDelimiterException(string input, string output) { //Given StringCalculator stringCalculator = new StringCalculator(); Exception ex = Assert.Throws <NumbersCannotBeEdgeOfDelimiterException>(() => stringCalculator.Add(input)); //When Assert.Equal($"Number can't be on edge of delimiter: {output}", ex.Message); }
static void Main(string[] args) { StringCalculator stringCalculator = new StringCalculator(); stringCalculator.Add("//;\n1;2"); }