Ejemplo n.º 1
0
        public void TestMatrixGeneratedWithCorrectDimensions(int letterIndex, int width)
        {
            var matrix = new DiamondMatrix(letterIndex);

            // row width/dimension length
            Assert.Equal(width, matrix.Matrix.GetLength(0));
            // column height/dimension length
            Assert.Equal(width, matrix.Matrix.GetLength(1));
        }
Ejemplo n.º 2
0
        public string[,] Start(ILetterLookupSvc letter)
        {
            var letterLookup = letter;
            var letterIndex  = letterLookup.ChosenLetterAlphabetIndex;
            var blankMatrix  = new DiamondMatrix(letterIndex);
            var matrix       = blankMatrix.Matrix;

            _matrixPopulator.PopulateMatrix(matrix, letter);

            return(matrix);
        }
Ejemplo n.º 3
0
        public void TestPopulateMatrix(string chosenLetter, string assertLetter, int horizontalIndexLeft, int horizontalIndexRight, int verticalIndex)
        {
            // arrange
            var lookup          = new LetterLookupSvc(chosenLetter);
            var matrixObject    = new DiamondMatrix(lookup.ChosenLetterAlphabetIndex);
            var matrix          = matrixObject.Matrix;
            var matrixPopulator = new MatrixPopulator();

            // act
            matrixPopulator.PopulateMatrix(matrix, lookup);


            // assert
            Assert.Equal(assertLetter, matrix[verticalIndex, horizontalIndexLeft]);
            Assert.Equal(assertLetter, matrix[verticalIndex, horizontalIndexRight]);
        }
Ejemplo n.º 4
0
        public void TestMatrixDimensionsCalculation(int letterIndex, int width)
        {
            var matrix = new DiamondMatrix(letterIndex);

            Assert.Equal(width, matrix.MatrixWidth);
        }