public void addReturnsInt() { var stringCalculator = new stringCalculator(); var add = stringCalculator.Add("0"); Assert.IsInstanceOfType(add, typeof(int)); }
public void testMaxNumberEqual() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add("//|\n1000|1|1"); const int expectedResult = 1002; Assert.AreEqual(expectedResult, add); }
public void addTwoNumbers() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add("1,4"); const int expectedResult = 5; Assert.AreEqual(expectedResult, add); }
public void allowMultpleDelimiters() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add("//[*][%]\n1*2%3"); const int expectedResult = 6; Assert.AreEqual(expectedResult, add); }
public void anyLenghtDelimters() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add("//[***]\n1***2***3”"); const int expectedResult = 6; Assert.AreEqual(expectedResult, add); }
public void chaningDelimiters() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add("//;\n10"); const int expectedresult = 10; Assert.AreEqual(expectedresult, add); }
public void addStringsWithDelimeters() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add("1\n7"); const int expectedResult = 8; Assert.AreEqual(expectedResult, add); }
public void addWhitespace() { var stringcalculator = new stringCalculator(); var add = stringcalculator.Add(new string(' ', 5)); const int expectedResult = 0; Assert.AreEqual(expectedResult, add); }
public void testingNegatives() { var negativeNumbers = "-1|-2|-3"; var stringcalculator = new stringCalculator(); try { var add = stringcalculator.Add($"//|\n{negativeNumbers}"); } catch (ArgumentException exceptionNegatives) { const string negativeMessage = "negatives not allowed"; Assert.IsTrue(exceptionNegatives.Message.ToUpper().Contains(negativeNumbers.Replace("|", ","))); } }