예제 #1
0
        public void PlayerRememberOtherPlayersGuessing()
        {
            //given
            var knowNumbersStub = MockRepository.GenerateStub <IKnowNumbers>();

            knowNumbersStub.Stub(x => x.RememberNumbers(1));

            var player = new CheaterPlayer(knowNumbersStub);

            //when
            player.NewNumberGuessed(45);

            //then
            knowNumbersStub.AssertWasCalled(x => x.RememberNumbers(1));
        }
예제 #2
0
        public void PlayerDontRememberOwnGuess()
        {
            //given
            var knowNumbersStub = MockRepository.GenerateStub <IKnowNumbers>();

            knowNumbersStub.Stub(x => x.RememberNumbers(1));

            var player = new CheaterPlayer(knowNumbersStub);

            player.GuessNumber();
            player.NewNumberGuessed(41);

            //then
            knowNumbersStub.AssertWasCalled(x => x.RememberNumbers(1));

            var newNumber = player.GuessNumber();

            //then
            //for this test I generate numbers in order
            Assert.That(newNumber, Is.EqualTo(42));
        }