public void Rows () { #region Rows int[][] s = new []{ new[]{1, 2, 3}, new[]{4, 5, 6}, new[]{7, 8, 9}, }; IEnumerable<IEnumerable<int>> r = s.Rows(); Assert.AreEqual (3, r.Count ()); Assert.IsTrue (new[]{1,2,3}.SequenceEqual (r.ElementAt (0))); Assert.IsTrue (new[]{4,5,6}.SequenceEqual (r.ElementAt (1))); Assert.IsTrue (new[]{7,8,9}.SequenceEqual (r.ElementAt (2))); #endregion }
public void TestExtensionMethods() { var aSqrMatrix = new[,] { {0D, 1D}, {4D, 5D}, {8D, 9D} }; var numOfRows = aSqrMatrix.Rows(); var numOfColumns = aSqrMatrix.Columns(); Assert.AreEqual(3,numOfRows); Assert.AreEqual(2, numOfColumns); }