public void Add_GivenOneAndTwo_ShouldReturnThree()
 {
     //---------------Set up test pack-------------------
     const string input = "1,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_GivenManyNumbers_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 = "999";
     const int expected = 999;
     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&&2";
     const int expected = 8;
     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,1005";
     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_GivenNegativeNumber_ShouldThrow()
 {
     //---------------Set up test pack-------------------
     const string input = "1,-2";
     const string expected = "Negatives not allowed: -2";
     var calculator = new Calculator();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actual = Assert.Throws<ApplicationException>(() => calculator.Add(input));
     //---------------Test Result -----------------------
     Assert.AreEqual(expected, actual.Message);
 }