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); } }
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); }
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); }
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); }
public void MatrixConstructorWithValidArgumentsShouldNotThrow() { IBoard board = new Game.Models.Matrix.Matrix(5, 5); }
public void MatrixConstructorWithNegativeWidthShouldThrow() { IBoard board = new Game.Models.Matrix.Matrix(-5, 5); }
public void MatrixConstructorWithNegativeHeightShouldThrow() { IBoard board = new Game.Models.Matrix.Matrix(5, -5); }
public void SwapCellValuesShouldThrowIfGivenWrongNumber() { int invalidTestNumber = 6; var matrixToSwap = new Game.Models.Matrix.Matrix(6, 6); matrixToSwap.SwapCellValues(invalidTestNumber); }
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); }