Exemple #1
0
        public void FillMatrixOfSizeOne_ShouldFillMatrixCorrectly()
        {
            int[,] matrix = RotatingWalkInMatrix.FillMatrix(1);

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

            CollectionAssert.AreEqual(expected, matrix);
        }
Exemple #2
0
        public void FillMatrixOfSizeThree_ShouldFillMatrixCorrectly()
        {
            int[,] matrix = RotatingWalkInMatrix.FillMatrix(3);

            int[,] expected =
            {
                { 1, 7, 8 },
                { 6, 2, 9 },
                { 5, 4, 3 }
            };

            CollectionAssert.AreEqual(expected, matrix);
        }
Exemple #3
0
        public void FillMatrixOfSizeSix_ShouldFillMatrixCorrectly()
        {
            int[,] matrix = RotatingWalkInMatrix.FillMatrix(6);

            int[,] expected =
            {
                {  1, 16, 17, 18, 19, 20 },
                { 15,  2, 27, 28, 29, 21 },
                { 14, 31,  3, 26, 30, 22 },
                { 13, 36, 32,  4, 25, 23 },
                { 12, 35, 34, 33,  5, 24 },
                { 11, 10,  9,  8,  7,  6 }
            };

            CollectionAssert.AreEqual(expected, matrix);
        }
Exemple #4
0
        public void FillMatrix_TwoDimensionalMatrix_ShouldFillCorrectMatrix()
        {
            // Arrange
            using (var sr = new StringReader("6"))
            {
                Console.SetIn(sr);

                // Act
                int[,] actual   = RotatingWalkInMatrix.FillMatrix(2);
                int[,] expected = new int[, ] {
                    { 1, 4 },
                    { 3, 2 }
                };

                // Assert
                CollectionAssert.AreEqual(expected, actual);
            }
        }
Exemple #5
0
        public void FillMatrix_ThreeDimensionalMatrix_ShouldFillCorrectMatrix()
        {
            // Arrange
            using (var sr = new StringReader("3"))
            {
                Console.SetIn(sr);

                // Act
                int[,] actual   = RotatingWalkInMatrix.FillMatrix(3);
                int[,] expected = new int[, ] {
                    { 1, 7, 8 },
                    { 6, 2, 9 },
                    { 5, 4, 3 }
                };

                // Assert
                CollectionAssert.AreEqual(expected, actual);
            }
        }
Exemple #6
0
        public void FillMatrix_SixDimensionalMatrix_ShouldFillCorrectMatrix()
        {
            // Arrange
            using (var sr = new StringReader("6"))
            {
                Console.SetIn(sr);

                // Act
                int[,] actual   = RotatingWalkInMatrix.FillMatrix(6);
                int[,] expected = new int[, ] {
                    { 1, 16, 17, 18, 19, 20 },
                    { 15, 2, 27, 28, 29, 21 },
                    { 14, 31, 3, 26, 30, 22 },
                    { 13, 36, 32, 4, 25, 23 },
                    { 12, 35, 34, 33, 5, 24 },
                    { 11, 10, 9, 8, 7, 6 }
                };

                // Assert
                CollectionAssert.AreEqual(expected, actual);
            }
        }