Ejemplo n.º 1
0
 public void Add_UnknownAmountOfNumbers_ReturnsSumOfTheNumbers(string numbers, int expected)
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expected,result);
 }
Ejemplo n.º 2
0
 public void Add_OneNumber_ReturnsSameNumber(string numbers, int expected)
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expected,result);
 }
Ejemplo n.º 3
0
 public void Add_TwoNumbers_RetunsSumOfTwoNumbers(string numbers, int expected)
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expected,result);
 }
Ejemplo n.º 4
0
 public void Add_NumbersSeparatedByNewLinesAndCommas_ReturnsSumOfTwoNumbers(string numbers, int expected)
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expected, result);
 }
Ejemplo n.º 5
0
 public void Add_NumbersSeparatedByDifferentDelimiters_ReturnsSumOfTheNumbers(string numbers, int expected)
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expected, result);
 }
Ejemplo n.º 6
0
 public void Add_NumbersGreaterThan1000_NumbersShouldBeIgnored(string numbers, int expected)
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expected,result);
 }
Ejemplo n.º 7
0
 public void Add_NegativeNumbers_ThrowsArgumentException(string numbers)
 {
     var calculator = new StringCalculator();
     var exception = Assert.Throws<ArgumentException>(() => calculator.Add(numbers));
     Assert.That(exception.Message, Is.EqualTo(string.Format("Negatives not allowed: -1,-2,-5")));
 }
Ejemplo n.º 8
0
 public void Add_EmptyString_ReturnsZero()
 {
     var calculator = new StringCalculator();
     int result = calculator.Add(string.Empty);
     Assert.AreEqual(0,result);
 }