public void TakeAttack_All_Ships_Sunk()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(3, 3, new Carrier(), Direction.Vertical);

            message = stateTracker.AddShip(1, 5, new Battleship(), Direction.Horizontal);
            message = stateTracker.AddShip(1, 2, new Cruiser(), Direction.Vertical);
            message = stateTracker.AddShip(6, 6, new Submarine(), Direction.Horizontal);
            message = stateTracker.AddShip(4, 7, new Destroyer(), Direction.Vertical);
            message = stateTracker.TakeAttack(1, 2);
            message = stateTracker.TakeAttack(2, 2);
            message = stateTracker.TakeAttack(3, 2);
            message = stateTracker.TakeAttack(1, 5);
            message = stateTracker.TakeAttack(1, 6);
            message = stateTracker.TakeAttack(1, 7);
            message = stateTracker.TakeAttack(1, 8);
            message = stateTracker.TakeAttack(3, 3);
            message = stateTracker.TakeAttack(4, 3);
            message = stateTracker.TakeAttack(5, 3);
            message = stateTracker.TakeAttack(6, 3);
            message = stateTracker.TakeAttack(7, 3);
            message = stateTracker.TakeAttack(6, 6);
            message = stateTracker.TakeAttack(6, 7);
            message = stateTracker.TakeAttack(6, 8);
            message = stateTracker.TakeAttack(4, 7);
            message = stateTracker.TakeAttack(5, 7);
            Assert.AreEqual("Hit. All ships sunk", message);
        }
        public void Add_Ships_Failure_Overlap_2()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(3, 3, new Carrier(), Direction.Vertical);

            message = stateTracker.AddShip(4, 2, new Battleship(), Direction.Horizontal);
            Assert.AreEqual("Battleship couldn't be placed successfully since there is an overlap with another ship", message);
        }
        public void Add_All_Ships_Success()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(3, 3, new Carrier(), Direction.Vertical);

            message = stateTracker.AddShip(1, 5, new Battleship(), Direction.Horizontal);
            message = stateTracker.AddShip(1, 2, new Cruiser(), Direction.Vertical);
            message = stateTracker.AddShip(6, 6, new Submarine(), Direction.Horizontal);
            message = stateTracker.AddShip(4, 7, new Destroyer(), Direction.Vertical);
            Assert.AreEqual("Destroyer placed successfully", message);
        }
        public void Battleship_58_Horizontal_Failure()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(5, 8, new Battleship(), Direction.Horizontal);

            Assert.AreEqual("Battleship couldn't placed successfully since not enough squares on the board", message);
        }
        public void Battleship_55_Vertical_Success()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(5, 5, new Battleship(), Direction.Vertical);

            Assert.AreEqual("Battleship placed successfully", message);
        }
        public void Carrier_75_Vertical_Failure()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(7, 5, new Carrier(), Direction.Vertical);

            Assert.AreEqual("Carrier couldn't placed successfully since not enough squares on the board", message);
        }
        public void Carrier_55_Horizontal_Success()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(5, 5, new Carrier(), Direction.Horizontal);

            Assert.AreEqual("Carrier placed successfully", message);
        }
        public void TakeAttack_All_Ships_Repeated()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(3, 3, new Carrier(), Direction.Vertical);

            message = stateTracker.AddShip(1, 5, new Battleship(), Direction.Horizontal);
            message = stateTracker.AddShip(1, 2, new Cruiser(), Direction.Vertical);
            message = stateTracker.AddShip(6, 6, new Submarine(), Direction.Horizontal);
            message = stateTracker.AddShip(4, 7, new Destroyer(), Direction.Vertical);

            for (int i = 1; i <= 20; i++)
            {
                message = stateTracker.TakeAttack(3, 3);
            }
            Assert.AreEqual("Hit", message);
        }
        public void Add_Ship_Invalid_Range()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(11, 11, new Carrier(), Direction.Horizontal);

            Assert.AreEqual("Row and Column numbers are invalid", message);
        }
        public void Destroyer_510_Horizontal_Failure()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(5, 10, new Destroyer(), Direction.Horizontal);

            Assert.AreEqual("Destroyer couldn't placed successfully since not enough squares on the board", message);
        }
        public void Destroyer_55_Vertical_Success()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(5, 5, new Destroyer(), Direction.Vertical);

            Assert.AreEqual("Destroyer placed successfully", message);
        }
        public void Submarine_58_Vertical_Success()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(5, 8, new Submarine(), Direction.Vertical);

            Assert.AreEqual("Submarine placed successfully", message);
        }
        public void TakeAttack_Hit()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(1, 2, new Cruiser(), Direction.Vertical);

            message = stateTracker.TakeAttack(1, 2);
            Assert.AreEqual("Hit", message);
        }
        public void TakeAttack_All_Ships_Sunk_Bruteforce()
        {
            IStateTracker stateTracker = new StateTracker();
            string        message      = stateTracker.AddShip(3, 3, new Carrier(), Direction.Vertical);

            message = stateTracker.AddShip(1, 5, new Battleship(), Direction.Horizontal);
            message = stateTracker.AddShip(1, 2, new Cruiser(), Direction.Vertical);
            message = stateTracker.AddShip(6, 6, new Submarine(), Direction.Horizontal);
            message = stateTracker.AddShip(4, 7, new Destroyer(), Direction.Vertical);

            for (int i = 1; i <= 10; i++)
            {
                for (int j = 1; j <= 10; j++)
                {
                    message = stateTracker.TakeAttack(i, j);
                    if (message.Contains("All ships sunk"))
                    {
                        Assert.AreEqual("Hit. All ships sunk", message);
                        break;
                    }
                }
            }
        }