public void TakeShootTest_AleadyShooted() { Field field = new Field_Valid_OneShip(); field.SetRandomShips(); field.TakeShoot(new Point(0)); field.TakeShoot(new Point(0)); }
public void TakeShootTest_CornerAutoMiss() { Field field = new Field_Valid_OneShip(); Point point = new Point(1); Ship ship = Ship.CreateNewShip(point, Orientation.Vertical, field.Ships[0].Id, field.Ships[0].Size); field.SetShip(ship); Assert.AreEqual(ShotResult.Miss, field.TakeShoot(new Point(point.X - 1, point.Y - 1))); Assert.AreEqual(CellStatus.Missed, field.Cells[point.Y - 1, point.X - 1]); Assert.AreEqual(ShotResult.Hit, field.TakeShoot(point)); Assert.AreEqual(CellStatus.Hit, field.Cells[point.Y, point.X]); Assert.AreEqual(CellStatus.Missed, field.Cells[point.Y - 1, point.X - 1]); Assert.AreEqual(CellStatus.AutoMissed, field.Cells[point.Y + 1, point.X - 1]); Assert.AreEqual(CellStatus.AutoMissed, field.Cells[point.Y - 1, point.X + 1]); Assert.AreEqual(CellStatus.AutoMissed, field.Cells[point.Y + 1, point.X + 1]); }
public void TakeShootTest_PointOutOfField() { Field field = new Field_Valid_OneShip(); field.SetRandomShips(); field.TakeShoot(new Point(-1)); }
public void TakeShootTest_NotSetShip() { Field field = new Field_Valid_OneShip(); field.TakeShoot(new Point(0)); }