示例#1
0
        public void ShouldThrowIfGetAllNumbersReceivesIncorrectArgument()
        {
            var checker  = new Mock <IPrimeChecker>();
            var runner   = new SequencialRunner(checker.Object);
            var topLimit = 1;

            runner.GetAllNumbers(topLimit);
        }
示例#2
0
        public void ShouldCalculatePrimeNumbers()
        {
            var checker  = new PrimeSquareBasedMethod();
            var runner   = new SequencialRunner(checker);
            var topLimit = 100;

            var result = runner.GetAllNumbers(topLimit);

            Assert.AreEqual(25, result.Count());
        }
示例#3
0
        public void ShouldCallChecker()
        {
            var checker = new Mock <IPrimeChecker>();

            checker.Setup(x => x.IsPrime(It.IsAny <int>()));
            var runner   = new SequencialRunner(checker.Object);
            var topLimit = 100;

            var result = runner.GetAllNumbers(topLimit);

            checker.Verify(x => x.IsPrime(It.IsAny <int>()), Times.AtMost(topLimit - 2));
        }