public void CannotAddHorizontalBattleshipIfSmallerThanPlan() { var plain = new Plain(10, 10); var battleship = new Battleships.StateManager.Entities.Battleship(new Position(0, 0), new Position(8, 0)); Assert.Throws <ArgumentOutOfRangeException>(() => plain.AddBattleship(battleship)); }
public void CanAddBattleshipHorizontal() { var plain = new Plain(10, 10); var battleship = new Battleships.StateManager.Entities.Battleship(new Position(0, 0), new Position(9, 0)); plain.AddBattleship(battleship); Assert.Equal(1, plain.Battleships.Count); }
public void CanAddBattleshipToPlain() { var mockPlain = new Mock <IHaveBattleships>(); var service = new BattleService(); var battleship = new Battleships.StateManager.Entities.Battleship(new Position(1, 1), new Position(2, 1)); service.AddBattleship(mockPlain.Object, battleship); mockPlain.Verify(x => x.AddBattleship(battleship), Times.Once); }
public void CanBuildVerticalBattleship() { var battleship = new Battleships.StateManager.Entities.Battleship(new Position(0, 0), new Position(0, 9)); Assert.Equal(10, battleship.Positions.Length); }
public void AddBattleship(IHaveBattleships plain, Battleship battleShip) { // do we need to check if two battleships can be placed adjacent? // not specified plain.AddBattleship(battleShip); }