Esempio n. 1
0
        public void CoordsTestZero()
        {
            Coords coords = new Coords(0, 0, 1);

            Assert.AreEqual(0, coords.Row);
            Assert.AreEqual(0, coords.Col);
        }
Esempio n. 2
0
        /// <summary>
        /// Method that checks if the current cell can be moved to new position.
        /// </summary>
        /// <param name="currCell">Sell to be moved.</param>
        /// <param name="cellToBeMoveTo">New coordinates where the sell will be moved.</param>
        /// <returns>Retruns true if the operation is valid and false otherwise.</returns>
        private bool CheckNeighbours(Coords currCell, Coords cellToBeMoveTo)
        {
            bool cellsRowsMatch = currCell.Row == cellToBeMoveTo.Row;
            bool cellsColsMatch = currCell.Col == cellToBeMoveTo.Col;
            bool isLeftCell = currCell.Col == cellToBeMoveTo.Col - 1;
            bool isRightCell = currCell.Col == cellToBeMoveTo.Col + 1;
            bool isUpCell = currCell.Row == cellToBeMoveTo.Row - 1;
            bool isDownCell = currCell.Row == cellToBeMoveTo.Row + 1;

            if (cellsRowsMatch && (isLeftCell || isRightCell))
            {
                return true;
            }
            else if (cellsColsMatch && (isUpCell || isDownCell))
            {
                return true;
            }

            return false;
        }
Esempio n. 3
0
 public void CoordsTestTooBigRowAndCol()
 {
     Coords coords = new Coords(10099, 132454, 4);
 }
Esempio n. 4
0
 public void CoordsTestNegativeRow()
 {
     Coords coords = new Coords(-1, 0, 1);
 }
Esempio n. 5
0
 public void CoordsTestNegativeDimentions()
 {
     Coords coords = new Coords(1, 1, -1);
 }
Esempio n. 6
0
 public void CoordsTestNegativeCol()
 {
     Coords coords = new Coords(1, -1, 1);
 }