public void RenderMatrixTest()
        {
            var testUIrenderer = new Game.UIRenderer.Renderers.ConsoleUIRenderer();
            var matrixTesting = new Game.Models.Matrix.Matrix(5, 5);

            try
            {
                testUIrenderer.RenderMatrix(matrixTesting);
            }
            catch (Exception ex)
            {
                Assert.Fail("Expected no exception, but got: " + ex.Message);
            }
        }
예제 #2
0
        public void AfterInitializationTwoMatricesShouldHaveDifferentShuffledNumbers()
        {
            IMatrix matrixOne = new Game.Models.Matrix.Matrix(5, 5);
            matrixOne.InitializeMatrix();
            IMatrix matrixTwo = new Game.Models.Matrix.Matrix(5, 5);
            matrixTwo.InitializeMatrix();
            bool areSame = true;

            for (int i = 0; i < matrixOne.Width; i++)
            {
                if (matrixOne.Field[i, 0] != matrixTwo.Field[i, 0])
                {
                    areSame = false;
                }
            }

            Assert.IsFalse(areSame);
        }
예제 #3
0
        public void MatrixShouldBeDeepCloned()
        {
            var myMatrixToTest = new Game.Models.Matrix.Matrix(5, 5);
            var clonedMatrix = myMatrixToTest.DeepClone();
            bool isSame = true;

            for (int i = 0; i < myMatrixToTest.Width; i++)
            {
                for (int j = 0; j < myMatrixToTest.Height; j++)
                {
                    if (myMatrixToTest.Field[i, j] != clonedMatrix.Field[i, j])
                    {
                        isSame = false;
                    }
                }
            }

            Assert.IsTrue(isSame);
        }
예제 #4
0
        public void MatrixShouldBeShuffled()
        {
            var notShuffledMatrix = new Game.Models.Matrix.Matrix(5, 5);
            var matrixToCompare = notShuffledMatrix.DeepClone();

            notShuffledMatrix.ShuffleMatrix();

            bool isShuffled = false;

            for (int i = 0; i < notShuffledMatrix.Width; i++)
            {
                for (int j = 0; j < notShuffledMatrix.Height; j++)
                {
                    if (notShuffledMatrix.Field[i, j] != matrixToCompare.Field[i, j])
                    {
                        isShuffled = true;
                    }
                }
            }

            Assert.IsTrue(isShuffled);
        }
예제 #5
0
 public void MatrixConstructorWithValidArgumentsShouldNotThrow()
 {
     IBoard board = new Game.Models.Matrix.Matrix(5, 5);
 }
예제 #6
0
 public void MatrixConstructorWithNegativeWidthShouldThrow()
 {
     IBoard board = new Game.Models.Matrix.Matrix(-5, 5);
 }
예제 #7
0
 public void MatrixConstructorWithNegativeHeightShouldThrow()
 {
     IBoard board = new Game.Models.Matrix.Matrix(5, -5);
 }
예제 #8
0
 public void SwapCellValuesShouldThrowIfGivenWrongNumber()
 {
     int invalidTestNumber = 6;
     var matrixToSwap = new Game.Models.Matrix.Matrix(6, 6);
     matrixToSwap.SwapCellValues(invalidTestNumber);
 }
예제 #9
0
        public void ShuffleMatrixShouldShuffleMatrix()
        {
            IMatrix matrix = new Game.Models.Matrix.Matrix(4, 4);
            matrix.InitializeMatrix();
            bool areSame = true;

            for (int i = 0; i < matrix.Width; i++)
            {
                var expect = i + 1;
                if (matrix.Field[0, i] != expect.ToString())
                {
                    areSame = false;
                }
            }

            Assert.IsFalse(areSame);
        }