Example #1
0
        public void OpponentGetHitInAnEncounter_OnAttack()
        {
            // Arrange.
            var opponent            = new SpaceShipSpy();
            var player              = SpaceShipWithTwoFunctionalWeaponStubs();
            var randomNumberService = AlwaysMaxRandomNumber();
            var encounter           = new Encounter(player, opponent, randomNumberService);

            // Act.
            encounter.Attack();

            // Assert.
            Assert.That(opponent.HitsCount, Is.EqualTo(2));
        }
        public void OpponentGetHitInAnEncounter_OnAttack()
        {
            // Arrange
            var opponent = new SpaceShipSpy();
            var player = SpaceShipWithTwoFunctionalWeaponStubs();
            var randomNumberService = AlwaysMaxRandomNumber();
            var encounter = new Encounter(player, opponent, randomNumberService);

            // Act
            encounter.Attack();

            // Assert
            Assert.That(opponent.HitsCount, Is.EqualTo(2));
        }
Example #3
0
        public void OpponentGetsNoHitsInEncounter_OnAttack()
        {
            // Arrange.
            int hitCount = 0;
            var opponent = Substitute.For <ISpaceShip>();

            opponent.AcceptIncomingShots(Arg.Do <IEnumerable <Shot> >(x => hitCount += x.Count()));

            var player = SpaceShipWithTwoFunctionalWeaponStubs();
            var randomNumberService = AlwaysMinRandomNumber();
            var encounter           = new Encounter(player, opponent, randomNumberService);

            // Act.
            encounter.Attack();

            // Assert.
            Assert.That(hitCount, Is.EqualTo(0));
        }
        public void OpponentGetsNoHitsInEncounter_OnAttack()
        {
            // Arrange

            int hitCount = 0;
            var opponent = Substitute.For<ISpaceShip>();
            opponent.AcceptIncomingShots (Arg.Do<IEnumerable<Shot>>(x => hitCount+=x.Count()) );

            var player = SpaceShipWithTwoFunctionalWeaponStubs();
            var randomNumberService = AlwaysMinRandomNumber();
            var encounter = new Encounter(player, opponent, randomNumberService);

            // Act
            encounter.Attack();

            // Assert
            Assert.That(hitCount,Is.EqualTo(0));
        }