public void TranslateRowTObjTest() { RectMatrix <string> matrix = new RectMatrix <string>(1, 1); matrix.EnsureSize(1, 1); object dataObj = new object(); object result = null; matrix.TranslateRow(0, (row, column, obj, x) => { result = obj; return(x); }, dataObj); Assert.AreSame(dataObj, result); }
public void TranslateRowGuardCase3Test() { RectMatrix <int> matrix = new RectMatrix <int>(2, 3); matrix.EnsureSize(2, 3); matrix[0, 0] = 7; matrix[0, 1] = 2; matrix[0, 2] = 3; matrix[1, 0] = 2; matrix[1, 1] = 5; matrix[1, 2] = 6; matrix.TranslateRow(0, null); }
public void TranslateRowGuardCase2Test() { RectMatrix <int> matrix = new RectMatrix <int>(2, 3); matrix.EnsureSize(2, 3); matrix[0, 0] = 7; matrix[0, 1] = 2; matrix[0, 2] = 3; matrix[1, 0] = 2; matrix[1, 1] = 5; matrix[1, 2] = 6; matrix.TranslateRow(2, (row, column, x) => x); }
public void TranslateRowTest() { RectMatrix <int> matrix = new RectMatrix <int>(2, 3); matrix.EnsureSize(2, 3); matrix[0, 0] = 7; matrix[0, 1] = 2; matrix[0, 2] = 3; matrix[1, 0] = 2; matrix[1, 1] = 5; matrix[1, 2] = 6; List <int> rowIndexList = new List <int>(); List <int> columnIndexList = new List <int>(); matrix.TranslateRow(1, (row, column, x) => { rowIndexList.Add(row); columnIndexList.Add(column); return(x + 2); }); Assert.AreEqual(7, matrix[0, 0]); Assert.AreEqual(2, matrix[0, 1]); Assert.AreEqual(3, matrix[0, 2]); Assert.AreEqual(4, matrix[1, 0]); Assert.AreEqual(7, matrix[1, 1]); Assert.AreEqual(8, matrix[1, 2]); CollectionAssert.AreEqual(new int[] { 1, 1, 1 }, rowIndexList); CollectionAssert.AreEqual(new int[] { 0, 1, 2 }, columnIndexList); }