예제 #1
0
        /// <summary>
        /// Create a different matrix depending of the input parameter.
        /// </summary>
        /// <param name="matrixType">Enumeration MatrixType - there are Big, Small and Medium matrix.</param>
        /// <returns>Returns a new instance of matrix.</returns>
        public IMatrix CreateMatrix(MatrixTypes matrixType)
        {
            var director = new MatrixDirector();
            MatrixBuilder builder;

            switch (matrixType)
            {
                case MatrixTypes.SMALL:
                    builder = new SmallMatrixBuilder();
                    break;
                case MatrixTypes.MEDIUM:
                    builder = new MediumMatrixBuilder();
                    break;
                case MatrixTypes.BIG:
                    builder = new BigMatrixBuilder();
                    break;
                default:
                    builder = new SmallMatrixBuilder();
                    break;
            }

            director.Construct(builder);

            return builder.GetMatrix();
        }
예제 #2
0
        /// <summary>
        /// Create a different matrix depending of the input parameter.
        /// </summary>
        /// <param name="matrixType">Enumeration MatrixType - there are Big, Small and Medium matrix.</param>
        /// <returns>Returns a new instance of matrix.</returns>
        public IMatrix CreateMatrix(MatrixTypes matrixType)
        {
            var           director = new MatrixDirector();
            MatrixBuilder builder;

            switch (matrixType)
            {
            case MatrixTypes.SMALL:
                builder = new SmallMatrixBuilder();
                break;

            case MatrixTypes.MEDIUM:
                builder = new MediumMatrixBuilder();
                break;

            case MatrixTypes.BIG:
                builder = new BigMatrixBuilder();
                break;

            default:
                builder = new SmallMatrixBuilder();
                break;
            }

            director.Construct(builder);

            return(builder.GetMatrix());
        }
예제 #3
0
        public void ExpectGetPrintFrameToReturntNotEmptyString()
        {
            var director = new MatrixDirector();
            var builder = new SmallMatrixBuilder();
            director.Construct(builder);
            var matrix = builder.GetMatrix();

            var player = new Player();

            var printer = new StandardPrinter();

            var result = printer.GetPrintFrame(matrix, player);

            Assert.AreNotEqual(result.Length, 0);
        }