コード例 #1
0
    public void PlaceShips_ChecksShipsAmount_ShipAmountCorrect()
    {
        OceanGrid grid = new OceanGrid(5);

        for (int i = 0; i < grid.NumRows; i++)
        {
            grid.AddShip(i, i);
        }

        Assert.IsTrue(grid.Ships.Count == 5);
    }
コード例 #2
0
    public void PlaceShips_ChecksShipPosition_ShipPositionIsCorrect()
    {
        OceanGrid grid = new OceanGrid(5);

        for (int i = 0; i < grid.Ships.Count; i++)
        {
            grid.AddShip(i, i);
        }

        for (int e = 0; e < grid.Ships.Count; e++)
        {
            Assert.IsTrue(grid.BoardLoc[e, e] == OceanGrid.States.Ship);
        }
    }