Beispiel #1
0
        public void CreateFromReaderReturnsNullWithoutResultSet()
        {
            var r = new TestDataReader();

            var resultSet = ResultSet.CreateFromReader(r);

            Assert.IsNull(resultSet);
        }
Beispiel #2
0
        public void CanCreateFromReaderWith2ColumnsAnd2Rows()
        {
            var resultSet = ResultSet.CreateFromReader(CreateTestReader());

            Assert.IsNotNull(resultSet);

            Assert.IsNotNull(resultSet.Schema);
            Assert.IsNotNull(resultSet.Schema.Columns);
            Assert.AreEqual(2, resultSet.Schema.Columns.Count);
            Assert.AreEqual("cola", resultSet.Schema.Columns[0].Name);
            Assert.AreEqual("varchar", resultSet.Schema.Columns[0].DbType);
            Assert.AreSame(typeof(string), resultSet.Schema.Columns[0].ClrType);
            Assert.AreEqual("colb", resultSet.Schema.Columns[1].Name);
            Assert.AreEqual("int", resultSet.Schema.Columns[1].DbType);
            Assert.AreSame(typeof(int), resultSet.Schema.Columns[1].ClrType);

            Assert.IsNotNull(resultSet.Rows);
            Assert.AreEqual(2, resultSet.Rows.Count);
            Assert.AreEqual("a", resultSet.Rows[0]["cola"]);
            Assert.AreEqual(33, resultSet.Rows[0]["colb"]);
            Assert.AreEqual("aa", resultSet.Rows[1]["cola"]);
            Assert.AreEqual(3333, resultSet.Rows[1]["colb"]);
        }
Beispiel #3
0
 public void CreateFromReaderTHrowsIfReaderIsNull()
 {
     ResultSet.CreateFromReader(null);
 }