Exemplo n.º 1
0
        public void ActivateBoard_WhenValidInputIsGiven_ReturnsActiveBoard()
        {
            var board = new Board();

            board.ActivateBoard();

            Assert.Equal(ModelState.Active, board.State);
            Assert.Equal(100, board.Coordinates.Length);
        }
Exemplo n.º 2
0
        public void PlaceShip_WhenNonValidCoordinatesGiven_ReturnsNull(int x, int y, int length,
                                                                       ShipOrientation shipOrientation)
        {
            var board = new Board();

            board.ActivateBoard();
            var initialCoordinate = new Coordinate(x, y);

            var added = board.PlaceShip(initialCoordinate, length, shipOrientation);

            Assert.False(added);
            Assert.Empty(board.Ships);
        }
Exemplo n.º 3
0
        public void PlaceShip_WhenValidCoordinatesGiven_ReturnsShip(int x, int y, int length,
                                                                    ShipOrientation shipOrientation)
        {
            var board = new Board();

            board.ActivateBoard();
            var initialCoordinate = new Coordinate(x, y);

            var added = board.PlaceShip(initialCoordinate, length, shipOrientation);

            Assert.True(added);
            Assert.Equal(length, board.Ships[0].Coordinates.Count);
        }