public void Shoot_ThrowsShootCellOutOfRangeException(int shootPointX, int shootPointY) { var shootStrategyAtPoint = new ShootStrategyAtPoint { ShootPoint = new Point(shootPointX, shootPointY) }; var field = new Field(5, 5); void Action() => shootStrategyAtPoint.Shoot(field); Assert.Throws <ShootCellOutOfRangeException>(Action); }
public void Shoot_OnEmptyCell_ThrowsShootCellCheckedException(int shootPointX, int shootPointY) { var shootStrategyAtPoint = new ShootStrategyAtPoint { ShootPoint = new Point(shootPointX, shootPointY) }; var field = new Field(5, 5); field.CellsMatrix[shootPointY, shootPointX].CellState = CellState.Empty; void Action() => shootStrategyAtPoint.Shoot(field); Assert.Throws <ShootCellCheckedException>(Action); }
public void Shoot_MissShipCell(int shootPointX, int shootPointY) { var shootStrategyAtPoint = new ShootStrategyAtPoint { ShootPoint = new Point(shootPointX, shootPointY) }; var field = new Field(5, 5); field.CellsMatrix[shootPointY + 1, shootPointX].CellState = CellState.Ship; var shootCell = shootStrategyAtPoint.Shoot(field); Assert.True(shootCell.CellState == CellState.Empty); }