public void Add_GivenMoreNumbers_ShouldReturnSum()
 {
     //---------------Set up test pack-------------------
     const string input = "1,2,3";
     const int expected = 6;
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = calculator.Add(input);
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual);
 }
 public void Add_GivenMultiDigitsNumber_ShouldReturnThatNumber()
 {
     //---------------Set up test pack-------------------
     const string input = "45";
     const int expected = 45;
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = calculator.Add(input);
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual);
 }
 public void Add_GivenEmptyString_ShouldReturnZero()
 {
     //---------------Set up test pack-------------------
     const string input = "";
     const int expected = 0;
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = calculator.Add(input);
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual);
 }
 public void Add_GivenNewDelimiter_ShouldReturnSum()
 {
     //---------------Set up test pack-------------------
     const string input = "//;\n1;2";
     const int expected = 3;
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = calculator.Add(input);
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual);
 }
 public void Add_GivenMultiDelimitersOfAnyLength_ShouldReturnSum()
 {
     //---------------Set up test pack-------------------
     const string input = "//[**][$$$]\n1**2$$$3";
     const int expected = 6;
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = calculator.Add(input);
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual);
 }
 public void Add_GivenNumberBiggerThan1000_ShouldIgnore()
 {
     //---------------Set up test pack-------------------
     const string input = "2,1003";
     const int expected = 2;
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = calculator.Add(input);
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual);
 }
 public void Add_GivenNegativeNumbers_ShouldThrow()
 {
     //---------------Set up test pack-------------------
     const string input = "1,-2,-3";
     const string expected = "Negatives not allowed: -2,-3";
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = Assert.Throws<ApplicationException>((() => calculator.Add(input)));
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual.Message);
 }