Exemplo n.º 1
0
 public void AddNewLinesAndCommasTest()
 {
     Calculator calc = new Calculator();
     string strNums = "1\n10,4\n1";
     int result = calc.Add(strNums);
     Assert.AreEqual<int>(16, result);
 }
Exemplo n.º 2
0
 public void AddMultipleArgumentsTest()
 {
     Calculator calc = new Calculator();
     string strNums = "1,5,6,10,105,5,8,0";
     int result = calc.Add(strNums);
     Assert.AreEqual<int>(140, result);
 }
Exemplo n.º 3
0
 public void AddChangeDelimiterTest()
 {
     Calculator calc = new Calculator();
     string strNums = "//:\n10:4:1";
     int result = calc.Add(strNums);
     Assert.AreEqual<int>(15, result);
 }
Exemplo n.º 4
0
 public void AddOneArgumentTest()
 {
     Calculator calc = new Calculator();
     Random rand = new Random(10);
     int arg = rand.Next();
     int result = calc.Add(arg.ToString());
     Assert.AreEqual<int>(arg, result);
 }
Exemplo n.º 5
0
 public void AddTwoArgumentsTest()
 {
     Calculator calc = new Calculator();
     Random rand = new Random(10);
     int arg1 = rand.Next();
     int arg2 = rand.Next();
     int result = calc.Add(arg1.ToString() + "," + arg2.ToString());
     Assert.AreEqual<int>(arg1 + arg2, result);
 }
Exemplo n.º 6
0
 public void AddNegativeThrowsExceptionTest()
 {
     Calculator calc = new Calculator();
     string strNums = "-10,-2,1";
     int result = calc.Add(strNums);
 }
Exemplo n.º 7
0
 public void AddEmptyStringTest()
 {
     Calculator calc = new Calculator();
     int result = calc.Add(String.Empty);
     Assert.AreEqual<int>(0, result);
 }