コード例 #1
0
        public void AttackEmptyLocation()
        {
            Setup();
            AttackResult result = _location.Attack();

            Assert.AreEqual(AttackResult.Miss, result);
            TearDown();
        }
コード例 #2
0
        public static AttackResult Attack(IArrayBoardObject board, Position attackLocation)
        {
            ILocation targetLocation = GetLocationOnArrayBoard.GetLocation(board, attackLocation);

            try
            {
                return(targetLocation.Attack());
            }
            catch (LocationAlreadyAttackedException)
            {
                throw new PositionAlreadyAttackedException(string.Format("Position {0} has already been attacked previously.", targetLocation.GetPositionId()));
            }
        }