public void IsDestroyedTest()
        {
            Ship testShip = new Ship(ShipName.AircraftCarrier);

            for (int i = 0; i < 5; i++)
            {
                testShip.Hit();
            }
            bool expected = true;
            bool actual   = testShip.IsDestroyed;

            Assert.AreEqual(expected, actual);
        }
示例#2
0
 /// <summary>
 /// Shoot allows a tile to be shot at, and if the tile has been hit before
 /// it will give an error
 /// </summary>
 internal void Shoot()
 {
     if ((false == Shot))
     {
         Shot = true;
         if (_Ship != null)
         {
             _Ship.Hit();
         }
     }
     else
     {
         throw new ApplicationException("You have already shot this square");
     }
 }