public void SimpleTest() { StringCalc calc = new StringCalc(); int value = calc.Sum("2,2"); Assert.That(value, Is.EqualTo(4), "Wrong actual value"); }
public void SumNonDigitArgumentReturnsMinusOne() { StringCalc calc = new StringCalc(); int actual = calc.Sum("2,test"); Assert.AreEqual(-1, actual); }
public void SumNegativeArgumentReturnsMinusOne() { StringCalc calc = new StringCalc(); int actual = calc.Sum("2,-1"); Assert.AreEqual(-1, actual); }
public void SumNullArgumentReturnsMinusOne() { StringCalc calc = new StringCalc(); int actual = calc.Sum(null); Assert.AreEqual(-1, actual); }
public void SumMoreThanTwoNumbersReturnsMinusOne() { StringCalc calc = new StringCalc(); int actual = calc.Sum("2,2,2"); Assert.AreEqual(-1, actual); }
public void SumOneAndTwoReturnsThree() { StringCalc calc = new StringCalc(); int actual = calc.Sum("1,2"); Assert.AreEqual(3, actual); }
public void SumShuldBeStartWithOUTSpatialSeparatorPutFailString() { StringCalc stringCalc = new StringCalc(); string str = "1,4\n5*7."; int expected = -1; int actual = stringCalc.Sum(str); Assert.That(actual, Is.EqualTo(expected)); }
public void SumShuldBeStartWithSpatialSeparator() { StringCalc stringCalc = new StringCalc(); string str = "//1,4\n5"; int expected = 10; int actual = stringCalc.Sum(str); Assert.That(actual, Is.EqualTo(expected)); }
public void SumCanHaveDifferents2LSeparators() { StringCalc stringCalc = new StringCalc(); string str = "1,4\n5"; int expected = 10; int actual = stringCalc.Sum(str); Assert.That(actual, Is.EqualTo(expected)); }
public void SumShouldBeNotHaveNegative() { StringCalc stringCalc = new StringCalc(); string str = "-1,2,3"; int expected = -1; int actual = stringCalc.Sum(str); Assert.That(actual, Is.EqualTo(expected)); }
public void SumShouldBeStringIsEmpty() { StringCalc stringCalc = new StringCalc(); string str = ""; int expected = 0; int actual = str.Length; Assert.That(actual, Is.EqualTo(expected)); }
public void SumShouldBeCorrect() { StringCalc stringCalc = new StringCalc(); string str = "0,1"; int expected = 1; int actual = stringCalc.Sum(str); Assert.That(actual, Is.EqualTo(expected)); }