public void EmptyParametherTest() { var calc = new StringCalculatorClass(); var result = calc.StringCalculator(""); Assert.AreEqual(0, result); }
public void ManyParamethersTest() { var calc = new StringCalculatorClass(); var result = calc.StringCalculator("1,2,3,4"); Assert.AreEqual(10, result); }
public void GivenAnEmptyStringReturnZero() { //Arrange var stringCalculator = new StringCalculatorClass(); //Act var emptyString = stringCalculator.Calculate(""); //Assert Assert.Equal(0, emptyString); }
public void DissalowNegativeNumbers() { //Arrange var stringCalculator = new StringCalculatorClass(); //Act var throws = Assert.Throws <ArgumentException>(() => stringCalculator.Calculate("1,-2,-3")); //Assert Assert.Equal("error: negatives not allowed", throws.Message); }
public void ReturnsAdditionWhenANewLineSeparatorIsUsed() { //Arrange var stringCalculator = new StringCalculatorClass(); //Act var newLineSperator = stringCalculator.Calculate("1\n2,3"); //Assert Assert.Equal(6, newLineSperator); }
public void AnyNumberOfNumbersReturnsThereAddition() { //Arrange var stringCalculator = new StringCalculatorClass(); //Act var manyNumbers = stringCalculator.Calculate("1,2,3,4,5,6,7,8,9"); //Assert Assert.Equal(45, manyNumbers); }
public void TwoNumbersReturnThereAddition() { //Arrange var stringCalculator = new StringCalculatorClass(); //Act var oneNumber = stringCalculator.Calculate("4,4"); //Assert Assert.Equal(8, oneNumber); }
public void GivenASingleNumberReturnNumber() { //Arrange var stringCalculator = new StringCalculatorClass(); //Act var oneNumber = stringCalculator.Calculate("4"); //Assert Assert.Equal(4, oneNumber); }