public void DestroyMast_When_DestroyAllFiveTimes_Then_BattleshipResponseIsSunk() { IBattleField battlefield = new Battlefield(10); Battleship battleship = new Battleship(5); battleship.TryLoadBattleshipToTheBattlefield(battlefield, 2, 2, Direction.Rigth); ShipResponse shipResponse = battleship.DestroyMast(3, 2); Assert.AreEqual(shipResponse, ShipResponse.Hit); battleship = new Battleship(5); battleship.TryLoadBattleshipToTheBattlefield(battlefield, 2, 2, Direction.Rigth); shipResponse = battleship.DestroyMast(2, 5); Assert.AreEqual(shipResponse, ShipResponse.Miss); shipResponse = battleship.DestroyMast(20, 20); Assert.AreEqual(shipResponse, ShipResponse.Miss); shipResponse = battleship.DestroyMast(2, 2); Assert.AreEqual(shipResponse, ShipResponse.Hit); shipResponse = battleship.DestroyMast(3, 2); Assert.AreEqual(shipResponse, ShipResponse.Hit); shipResponse = battleship.DestroyMast(4, 2); Assert.AreEqual(shipResponse, ShipResponse.Hit); shipResponse = battleship.DestroyMast(5, 2); Assert.AreEqual(shipResponse, ShipResponse.Hit); shipResponse = battleship.DestroyMast(6, 2); Assert.AreEqual(shipResponse, ShipResponse.Sunk); }
public void IsShipAlive_When_AllMastIsDestroyed_Then_ResponseIsFalse() { IBattleField battlefield = new Battlefield(10); Battleship battleship = new Battleship(5); battleship.TryLoadBattleshipToTheBattlefield(battlefield, 2, 2, Direction.Rigth); battleship.DestroyMast(2, 2); battleship.DestroyMast(3, 2); battleship.DestroyMast(4, 2); battleship.DestroyMast(5, 2); battleship.DestroyMast(6, 2); bool expectedResponse = false; bool actualResponse = battleship.IsTheShipAlive(); Assert.AreEqual(expectedResponse, actualResponse); }
public void DestroyMast_When_TryDestroyMastOutOfTheShip_Then_BattleshipResponseIsMiss() { IBattleField battlefield = new Battlefield(10); Battleship battleship = new Battleship(5); battleship.TryLoadBattleshipToTheBattlefield(battlefield, 2, 2, Direction.Rigth); ShipResponse shipResponse = battleship.DestroyMast(3, 2); Assert.AreEqual(shipResponse, ShipResponse.Hit); battleship = new Battleship(5); battleship.TryLoadBattleshipToTheBattlefield(battlefield, 2, 2, Direction.Rigth); shipResponse = battleship.DestroyMast(2, 5); Assert.AreEqual(shipResponse, ShipResponse.Miss); shipResponse = battleship.DestroyMast(20, 20); Assert.AreEqual(shipResponse, ShipResponse.Miss); }