public void MatrixMultiplicationTest() { BaseOperation operation = new MatrixMultiply(); operation.Matrix1 = new int[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; operation.Matrix2 = new int[, ] { { 1, 2 }, { 3, 4 }, { 5, 6 } }; operation.Calculate(); Assert.AreEqual(new int[, ] { { 22, 28 }, { 49, 64 }, { 76, 100 } }, operation.MatrixResult); }
public void GetMatrixValueFromHistory() { Operations operation = new MatrixMultiply(); operation.Matrix1 = new int[, ] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; operation.Matrix2 = new int[, ] { { 1, 2 }, { 3, 4 }, { 5, 6 } }; operation.Calculate(); operation.SaveDisplayRes(); HistoryManager.AddLog(operation.calculation); var actual = HistoryManager.history.ElementAt(2); var expected = "matrix multiplication result : {1,2,3},{4,5,6},{7,8,9} * {1,2},{3,4},{5,6} = {22,28},{49,64},{76,100}"; Assert.AreEqual(expected, actual); }