Example #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);
        }
Example #2
0
 /// <summary>
 /// Transpose matrix.
 /// </summary>
 public virtual void Transpose()
 {
     _history.Backup();
     Matrix = Matrix.Transpose();
 }