示例#1
0
        public void TestRead()
        {
            using (IDataReader reader = new InMemoryDataReader(false, this.Data1))
            {
                Assert.IsTrue(reader.Read(), "Read 1");
                Assert.AreEqual("R1C2", reader.GetString(1));

                Assert.IsTrue(reader.Read(), "Read 2");
                Assert.AreEqual("R2C1", reader.GetString(0));

                Assert.IsTrue(reader.Read(), "Read 3");
                Assert.AreEqual("R3C3", reader.GetString(2));

                Assert.IsFalse(reader.Read(), "Read 4");
            }
        }
示例#2
0
 public void TestGetValueNotReadYet()
 {
     using (IDataReader reader = new InMemoryDataReader(false, this.Data1))
     {
         reader.GetString(0);
     }
 }
示例#3
0
 public void TestGetStringNull()
 {
     using (IDataReader reader = new InMemoryDataReader(false, this.Data4))
     {
         Assert.IsTrue(reader.Read(), "Read");
         reader.GetString(1);
     }
 }
示例#4
0
 public void TestNextResult()
 {
     using (IDataReader reader = new InMemoryDataReader(false, this.Data1, this.Data2))
     {
         Assert.AreEqual(3, reader.FieldCount, "Field count.");
         Assert.IsTrue(reader.NextResult(), "Next result");
         Assert.AreEqual(2, reader.FieldCount, "Field count has changed.");
         Assert.IsTrue(reader.Read(), "Read");
         Assert.AreEqual("TWO R1C2", reader.GetString(1), "Row 1 column 2.");
     }
 }