Exemple #1
0
        public void DoCombatAcceptSurrender()
        {
            // Arrange
            Mock <Npc> mockNpcRow = new Mock <Npc>();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.CombatId)
            .Returns(2);
            mockNpcRow.Expect(n => n.Ship.InProgressCombat.Status)
            .Returns(Combat.CombatStatus.Incomplete);

            // Setup it up so that it's the police turn
            mockNpcRow.Expect(n => n.Ship.InProgressCombat.ShipTurn.ShipId)
            .Returns(1)
            .Verifiable();
            mockNpcRow.Expect(n => n.Ship.ShipId)
            .Returns(1)
            .Verifiable();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.Surrendered)
            .Returns(true)
            .Verifiable();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.AcceptSurrender())
            .Verifiable();

            NpcPolice police = new NpcPolice(mockNpcRow.Object);

            // Act
            police.DoCombat();

            // Assert
            mockNpcRow.Verify();
        }
Exemple #2
0
        public void DoCombatChargeJumpdrive()
        {
            // Arrange
            Mock <Npc> mockNpcRow = new Mock <Npc>();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.CombatId)
            .Returns(2);
            mockNpcRow.Expect(n => n.Ship.InProgressCombat.Status)
            .Returns(Combat.CombatStatus.Incomplete);

            // Setup it up so that it's the police turn
            mockNpcRow.Expect(n => n.Ship.InProgressCombat.ShipTurn.ShipId)
            .Returns(1)
            .Verifiable();
            mockNpcRow.Expect(n => n.Ship.ShipId)
            .Returns(1)
            .Verifiable();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.Surrendered)
            .Returns(false)
            .Verifiable();
            mockNpcRow.Expect(n => n.Ship.InProgressCombat.CargoJettisoned)
            .Returns(false)
            .Verifiable();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.FireWeapon())
            .Throws(new ArgumentOutOfRangeException("Out of turn points"))
            .Verifiable();

            mockNpcRow.Expect(n => n.Ship.InProgressCombat.ChargeJumpDrive())
            .Verifiable();

            NpcPolice police = new NpcPolice(mockNpcRow.Object);

            // Act
            police.DoCombat();

            // Assert
            mockNpcRow.Verify();
        }