public void MatrixMementoConstructProperMatrix(int rows, int cols) { ICell[,] field = new ICell[rows, cols]; MatrixMemento memento = new MatrixMemento(field); Assert.AreEqual(field.GetLength(0), memento.Field.GetLength(0), "Memento field expected rows are not equal to actual rows"); Assert.AreEqual(field.GetLength(1), memento.Field.GetLength(1), "Memento field expected cols are not equal to actual cols"); }
/// <summary> /// Loads the previously saved state /// </summary> /// <param name="memento">Needs as parameter the saved state</param> public void RestoreMemento(MatrixMemento memento) { this.Field = memento.Field; }
public void MatrixMementoEmptyConstructorTest() { MatrixMemento memento = new MatrixMemento(); Assert.IsInstanceOf(typeof(MatrixMemento), memento, "Memento instance doesn't exist"); }