public void MatrixSaveMementoAndRestoreMementoMethodsWorkProper() { ICell[,] fieldExpected = new ICell[3, 7]; Matrix matrix = new Matrix(); matrix.Field = fieldExpected; MatrixMemento matrixMemento = matrix.SaveMemento(); matrix.Field = new ICell[12, 18]; matrix.RestoreMemento(matrixMemento); // Comment this row and the test will fail Assert.AreEqual(fieldExpected.GetLength(0), matrix.Rows, "Matrix SaveMememento and RestoreMememento doesn't work proper"); Assert.AreEqual(fieldExpected.GetLength(1), matrix.Cols, "Matrix SaveMememento and RestoreMememento doesn't work proper"); }
/// <summary> /// Sets the obligatory parameters needed to process the commands in the constuctor /// </summary> /// <param name="matrix">import the matrix</param> /// <param name="player">set the current player</param> /// <param name="printer">import the printer</param> public Command(Matrix matrix, Player player, Printer printer) { this.Matrix = matrix; this.Player = player; this.Printer = printer; }
/// <summary> /// Constructor for the invalid command. /// </summary> /// <param name="matrix">Current game matrix</param> /// <param name="player">Current game player.</param> /// <param name="printer">Current game printer.</param> public InvalidCommand(Matrix matrix, Player player, Printer printer) : base(matrix, player, printer) { }
/// <summary> /// Constructor for the highscore command /// </summary> /// <param name="engine">Game engine.</param> /// <param name="matrix">Game matrix</param> /// <param name="player">Current player</param> /// <param name="printer">Current game printer</param> public HighScoreCommand(MinesweeperEngine engine, Matrix matrix, Player player, Printer printer) : base(matrix, player, printer) { this.engine = engine; }
/// <summary> /// Constructor for the Save command. /// </summary> /// <param name="matrix">Current game matrix.</param> /// <param name="player">Current game player</param> /// <param name="printer">Current game printer</param> public SaveCommand(Matrix matrix, Player player, Printer printer) : base(matrix, player, printer) { }