public void TestChangeInYDirectionWithWrongValue()
        {
            MatrixWalker matrixWalker = new MatrixWalker();
            int stepInDirectionX = 0;
            int stepInDirectionY = -2;

            matrixWalker.ChangeDirection(ref stepInDirectionX, ref stepInDirectionY);
        }
        public void TestForFindNextFreeCellInYDirection()
        {
            MatrixWalker matrixWalker = new MatrixWalker();

            int[,] matrix =
            {
                {0,0,0},
                {0,0,0},
                {0,0,0}
            };

            int positionX = 0;
            int positionY = 0;

            matrixWalker.FindNextFreeCell(matrix, out positionX, out positionY);

            Assert.AreEqual(0, positionY);
        }
示例#3
0
        public static void Main()
        {
            MatrixCreator matrixCerator = new MatrixCreator();

            int matrixSize = matrixCerator.GetMatrixSize();

            int[,] matrix = new int[matrixSize, matrixSize];

            MatrixWalker matrixWalker = new MatrixWalker();

            int positionIndex = 1;

            int positionX = 0;
            int positionY = 0;

            int stepInDirectionX = 1;
            int stepInDirectionY = 1;

            matrixWalker.ConstructMatrix(matrix, ref positionIndex, ref positionX, ref positionY, ref stepInDirectionX, ref stepInDirectionY);

            matrixCerator.PrintMatrix(matrix);
        }
        public void TestIfMethodForValidDirectionReturnFalse()
        {
            MatrixWalker matrixWalker = new MatrixWalker();

            int[,] matrix =
            {
                {1,1,1},
                {1,1,1},
                {1,1,1}
            };

            int positionX = 0;
            int positionY = 0;

            bool actual = matrixWalker.CheckForValidDirection(matrix, positionX, positionY);

            Assert.AreEqual(false, actual);
        }
        public void TestValidInitialPositionInY()
        {
            MatrixWalker matrixWalker = new MatrixWalker();

            int[,] matrix =
            {
                {0,0,0},
                {0,0,0},
                {0,0,0}
            };

            int positionIndex = 1;

            int positionX = 0;
            int positionY = 1;

            int stepInDirectionX = 1;
            int stepInDirectionY = 1;

            matrixWalker.ConstructMatrix(matrix, ref positionIndex, ref positionX, ref positionY, ref stepInDirectionX, ref stepInDirectionY);
        }