示例#1
0
        public void CanCreateFromReader()
        {
            var r = new TestDataReader();

            r.ResultSets.Add(new ResultSet());
            r.ResultSets[0].Schema.Columns.Add(new Column {
                Name = "cola", ClrType = typeof(DateTime), DbType = "datetime"
            });
            r.ResultSets[0].Schema.Columns.Add(new Column {
                Name = "colb", ClrType = typeof(string), DbType = "varchar"
            });

            var rss = ResultSetSchema.CreateFromReader(r);

            Assert.IsNotNull(rss);
            Assert.IsNotNull(rss.Columns);
            Assert.AreEqual(2, rss.Columns.Count);
            Assert.AreEqual("cola", rss.Columns[0].Name);
            Assert.AreEqual("colb", rss.Columns[1].Name);
            Assert.AreEqual("datetime", rss.Columns[0].DbType);
            Assert.AreEqual("varchar", rss.Columns[1].DbType);
            Assert.AreSame(typeof(DateTime), rss.Columns[0].ClrType);
            Assert.AreEqual(typeof(string), rss.Columns[1].ClrType);
        }
示例#2
0
 public void CannotCreateFromReaderWhenReaderIsNull()
 {
     ResultSetSchema.CreateFromReader(null);
 }