public void adding_two_plus_1001_equals_2()
 {
     // adding 2 + 1001  = 2
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("2,1001");
     Assert.AreEqual(2, result);
 }
 public void LongDelimeterTest()
 {
     /*
      //[***]\n1***2***3” should return 6
      */
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("//[***]\n1***2***3");
     Assert.AreEqual(6, result);
 }
 public void if_there_are_multiple_negatives_show_all_of_them_in_the_exception_message()
 {
     var stringCalculator = new StringCalculator();
     try
     {
         stringCalculator.Add("-1,-2");
     }
     catch (Exception e)
     {
         Assert.AreEqual("Negatives not allowed (-1,-2)", e.Message);
     }
 }
 public void exception_should_say_the_negative_that_was_passed()
 {
     var stringCalculator = new StringCalculator();
     try
     {
         stringCalculator.Add("-1");
     }
     catch (Exception e)
     {
         Assert.AreEqual("Negatives not allowed (-1)", e.Message);
     }
 }
 public void four_numbers_should_add_them_all()
 {
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("10,10,10,10");
     Assert.AreEqual(40, result);
 }
Exemplo n.º 6
0
 public void MultipleCustomDelimitersMultipleChars()
 {
     Assert.AreEqual(8, StringCalculator.Add("//[***][--]\n1***2--5"));
 }
 public void Input_1_NL_2_COMMA_3_WILL_EQUAL_6()
 {
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("1\n2,3");
     Assert.AreEqual(6, result);
 }
 public void take_two_numbers_should_add_them()
 {
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("1,2");
     Assert.AreEqual(3, result);
 }
Exemplo n.º 9
0
 public void IgnoreGreaterThan1000()
 {
     Assert.AreEqual(4, StringCalculator.Add("1,1001,3"));
 }
Exemplo n.º 10
0
 public void CustomDelimiter()
 {
     Assert.AreEqual(3, StringCalculator.Add("//;\n1;2"));
 }
Exemplo n.º 11
0
 public void NewLineDelimited()
 {
     Assert.AreEqual(6, StringCalculator.Add("1\n2,3"));
 }
Exemplo n.º 12
0
 public void Add3numbers()
 {
     Assert.AreEqual(6, StringCalculator.Add("1,2,3"));
 }
Exemplo n.º 13
0
 public void Add1()
 {
     Assert.AreEqual(4, StringCalculator.Add("4"));
 }
Exemplo n.º 14
0
 public void Add1and2()
 {
     Assert.AreEqual(3, StringCalculator.Add("1,2"));
 }
 public void for_an_empty_string_it_will_return_0()
 {
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add(string.Empty);
     Assert.AreEqual(0, result);
 }
 public void take_one_number_should_return_it()
 {
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("1");
     Assert.AreEqual(1, result);
 }
Exemplo n.º 17
0
 public void AddEmptyReturns0()
 {
     Assert.AreEqual(0, StringCalculator.Add(""));
 }
Exemplo n.º 18
0
 public void DontIgnore1000()
 {
     Assert.AreEqual(1004, StringCalculator.Add("1,1000,3"));
 }
Exemplo n.º 19
0
 public void MultipleCharacterDelimiter()
 {
     Assert.AreEqual(7, StringCalculator.Add("//***\n2***1***4"));
 }
 public void will_throw_an_exception__negatives_not_allowed()
 {
     var stringCalculator = new StringCalculator();
     AssertHelper.AssertThrows<NegativesNotAllowedException>(() => stringCalculator.Add("-1"));
 }
 private void Calculate(String numbers, int expectedNumber)
 {
     StringCalculator calculator = new StringCalculator();
     int result = calculator.Add(numbers);
     Assert.AreEqual(expectedNumber, result);
 }
 public void _a_method_int_Add_string_numbers()
 {
     var c = new StringCalculator();
     string numbers = "";
     int result = c.Add(numbers);
 }
Exemplo n.º 23
0
 public void Initialize()
 {
     calculator = new StringCalculator();
 }
 public void SEMIDelimiter_NL_1_SEMI_2_SHOULD_RETURN_3()
 {
     var stringCalculator = new StringCalculator();
     var result = stringCalculator.Add("//;\n1;2");
     Assert.AreEqual(3, result);
 }
Exemplo n.º 25
0
 public void MultipleCustomDelimiters()
 {
     Assert.AreEqual(6, StringCalculator.Add("//[*][%]\n1*2%3"));
 }