예제 #1
0
        public void MatrixHistory_Matrix_EqualsToItself()
        {
            var matrix1 = new Matrix(new List <List <long> >
            {
                new List <long> {
                    0, 3, 0
                },
                new List <long> {
                    0, 2, 0
                },
                new List <long> {
                    0, 1, 0
                }
            });
            var matrixCheck = new Matrix(new List <List <long> >
            {
                new List <long> {
                    0, 3, 0
                },
                new List <long> {
                    0, 2, 0
                },
                new List <long> {
                    0, 1, 0
                }
            });
            var history = new MatrixHistory(matrix1);

            history.Backup();
            history.Matrix[0, 0] = 1;
            history.Backup();
            history.Matrix[0, 0] = 2;
            history.Undo();
            history.Undo();
            Assert.AreEqual(history.Matrix, matrixCheck);
        }
예제 #2
0
 /// <summary>
 /// Constructs class instance.
 /// </summary>
 /// <param name="matrix">Matrix to be encapsulated.</param>
 public MatrixFacade(Matrix matrix)
 {
     _history = new MatrixHistory(matrix);
 }