コード例 #1
0
        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");
        }
コード例 #2
0
ファイル: Matrix.cs プロジェクト: Minesweeper-4/Minesweeper-4
 /// <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;
 }
コード例 #3
0
        public void MatrixMementoEmptyConstructorTest()
        {
            MatrixMemento memento = new MatrixMemento();

            Assert.IsInstanceOf(typeof(MatrixMemento), memento, "Memento instance doesn't exist");
        }