예제 #1
0
        private bool IsPlaceForVerticalShipTest(int gridSize, int shipSize)
        {
            var filler  = new ShipsVerticalFiller(null);
            var squares = new SquareStates[gridSize, gridSize];

            return(filler.IsPlaceForVerticalShip(squares, gridSize - 1, 0, 0, shipSize));
        }
예제 #2
0
        public void Fill_Negative(int gridSize, int shipSize, int shipCount)
        {
            var ships = PrepareShips(new Dictionary <int, int>()
            {
                { shipSize, shipCount }
            });
            var filler  = new ShipsVerticalFiller(ships);
            var squares = new SquareStates[gridSize, gridSize];

            filler.Fill(ref squares, gridSize);
        }
예제 #3
0
        public void Fill_Positive(int gridSize, int shipSize, int shipCount)
        {
            var ships = PrepareShips(new Dictionary <int, int>()
            {
                { shipSize, shipCount }
            });
            var filler  = new ShipsVerticalFiller(ships);
            var squares = new SquareStates[gridSize, gridSize];

            var shipsOnGrid = filler.Fill(ref squares, gridSize);

            Assert.AreEqual(shipCount, shipsOnGrid.Count, $"There should be {shipCount} ships placed on grid ({gridSize}).");
        }