public void CanCreateFromReader() { var r = new TestDataReader(); var rs = new ResultSet(); r.ResultSets.Add(rs); rs.Schema.Columns.Add(new Column { Name = "cola", ClrType = typeof(string), DbType = "varchar" }); rs.Schema.Columns.Add(new Column { Name = "colb", ClrType = typeof(int), DbType = "int" }); var row = new ResultSetRow(); row["cola"] = "will"; row["colb"] = 33; rs.Rows.Add(row); Assert.IsTrue(r.Read()); // check that read works var readerRow = ResultSetRow.CreateFromReader(r); Assert.IsNotNull(readerRow); Assert.AreEqual(2, readerRow.Count); Assert.AreEqual("will", readerRow["cola"]); Assert.AreEqual(33, readerRow["colb"]); }
public void CreateFromReaderThrowsWithNullReader() { Assert.ThrowsException <ArgumentNullException>(() => { ResultSetRow.CreateFromReader(null); }, "reader"); }