public void Validate_IsValidLengthForColumns_ThrowsArgumentException() { var board = TestData.TestData.GetBoard(10, 10); var coordinate = new Coordinate(10, 10, 2, Services.Enums.Alignment.Horizantal); var squares = board.FindSquares(coordinate); var validatePlacementOfShips = new ValidatePlacementOfShip(); var result = Assert.Throws <ArgumentException>(() => validatePlacementOfShips.Validate(coordinate, board, squares)); result.Message.Should().Be(BattleshipConstants.InvalidShipLength); }
public void Validate_Overlapping_ThrowsInvalidOperationException() { var board = TestData.TestData.GetBoard(1, 11); var coordinate = new Coordinate(1, 1, 1, Services.Enums.Alignment.Horizantal); var squares = board.FindSquares(coordinate); squares.ForEach(s => s.Status = Services.Enums.SquareStatus.occupied); var validatePlacementOfShips = new ValidatePlacementOfShip(); var result = Assert.Throws <InvalidOperationException>(() => validatePlacementOfShips.Validate(coordinate, board, squares)); result.Message.Should().Be(BattleshipConstants.ShipOverLaping); }