예제 #1
0
        public void GetCalledCountReturnZero__WhenCalled(int calcCallCount)
        {
            var numbers    = "1,2";
            var calculator = new StringCalculator(new [] { "," });


            var oldCallCount = calculator.GetCalledCount();

            Enumerable.Range(0, calcCallCount).ToList().ForEach(_ => calculator.Add(numbers));
            var calledCount = calculator.GetCalledCount();

            var nowCalledCount = calledCount - oldCallCount;

            Assert.AreEqual(calcCallCount, nowCalledCount);
        }
예제 #2
0
 public void GetCalledCount_returns_how_many_times_Add_was_called(int callCount)
 {
     for (int i = 0; i < callCount; i++)
     {
         sc.Add(string.Empty);
     }
     Assert.True(sc.GetCalledCount() == callCount);
 }
예제 #3
0
        public void TDDTask_StringCalculator_Add_ReturnCountOfCallingMethod()
        {
            var testInput  = string.Empty;
            var testInput2 = "1\n2,3";
            var testInput3 = "//;1\n2,3";

            stringCalculator.Add(testInput);
            stringCalculator.Add(testInput2);
            stringCalculator.Add(testInput3);

            Assert.AreEqual(3, stringCalculator.GetCalledCount());
        }