コード例 #1
0
        public void AttackIsSafe_AttackingNeutralRegion_ReturnsTrue()
        {
            var fromRegion = _gameState.AddRegion(_myName, 2);
            var toRegion   = _gameState.AddRegion(Constants.NeutralPlayerName, 2);

            fromRegion.Neighbors.Add(toRegion);

            var result = BattleAnalysis.AttackIsSafe(fromRegion, 1, toRegion, toRegion.Armies, _myName, 0.90f);

            Assert.IsTrue(result);
        }
コード例 #2
0
        public void ResolveConditionalAttacks_LoneTargetWithThreeWeakAttackers_NoMoves()
        {
            var targetRegion = _gameState.AddRegion(TestGameState.EnemyName, 10);
            var attacker1    = _gameState.AddRegion(TestGameState.MyPlayerName, 5);
            var attacker2    = _gameState.AddRegion(TestGameState.MyPlayerName, 5);
            var attacker3    = _gameState.AddRegion(TestGameState.MyPlayerName, 5);

            targetRegion.AddNeighbor(attacker1);
            targetRegion.AddNeighbor(attacker2);
            targetRegion.AddNeighbor(attacker3);

            _attackList.Add(attacker1, targetRegion, attacker1.Armies - 1);
            _attackList.Add(attacker2, targetRegion, attacker2.Armies - 1);
            _attackList.Add(attacker3, targetRegion, attacker3.Armies - 1);

            _attackList.ResolveConditionalAttacks(_committedMoves);

            Assert.AreEqual(0, _committedMoves.Count);
        }
        public void For_NeedsAFewArmies_ReturnsNeededNumber()
        {
            var testRegion = _gameState.AddRegion(_myName, 6);

            var neighbor1 = _gameState.AddRegion(_enemyName, 5);

            testRegion.AddNeighbor(neighbor1);

            var neighbor2 = _gameState.AddRegion(_enemyName, 5);

            testRegion.AddNeighbor(neighbor2);

            var result = DefensiveArmiesNeeded.For(testRegion.Neighbors, testRegion.Armies, 5);

            Assert.AreEqual(4, result);
        }