public void When_BattleshipOfLength1_IsAtJ1NorthSouth_ThenItShouldBeInboundsWithASinglePositionJ1() { var battleship = new Battleship { Length = 1 }; var location = new Location { Column = 'J', Row = 1, Placement = Direction.NorthSouth }; var(positions, inbounds) = GameBoardCalculations.ValidateLocation(battleship, location); Assert.True(inbounds); Assert.Contains(positions, p => p.Column == 'J' && p.Row == 1); }
public void When_BattleshipOfLength2_IsAtJ10NorthSouth_ThenItShouldNotBeInbounds() { var battleship = new Battleship { Length = 2 }; var location = new Location { Column = 'J', Row = 10, Placement = Direction.NorthSouth }; var(positions, inbounds) = GameBoardCalculations.ValidateLocation(battleship, location); Assert.False(inbounds); Assert.Null(positions); }
public void When_BattleshipOfLength1_IsAtA10EastWest_ThenItShouldBeInboundsWithASinglePositionA10() { var battleship = new Battleship { Length = 1 }; var location = new Location { Column = 'A', Row = 10, Placement = Direction.EastWest }; var(positions, inbounds) = GameBoardCalculations.ValidateLocation(battleship, location); Assert.True(inbounds); Assert.Contains(positions, p => p.Column == 'A' && p.Row == 10); }
public void When_BattleshipOfLength11_IsAtA10EastWest_ThenItShouldNotBeInbounds() { var battleship = new Battleship { Length = 11 }; var location = new Location { Column = 'A', Row = 10, Placement = Direction.EastWest }; var(positions, inbounds) = GameBoardCalculations.ValidateLocation(battleship, location); Assert.False(inbounds); Assert.Null(positions); }