Exemplo n.º 1
0
        public void Metadata_Test()
        {
            using (var cmd = Execute.Command(DatabaseConfigurationContext.DefaultConnectionString))
            {
                cmd.CommandText = SingleStatment;
                cmd.CommandType = System.Data.CommandType.Text;
                using (var dr = new IndexedSqlDataReader(cmd.ExecuteReader(), type: typeof(TestObject)))
                {
                    dr.ReadFullControl((reader) =>
                    {
                        Assert.True(reader.HasColumn("id"));
                        Assert.True(reader.GetColumnIndex("id") == reader.GetOrdinal("id"));
                        Assert.False(reader.IsClosed);
                    });

                    DataException de = null;
                    try
                    {
                        IndexedSqlDataReader.ThrowDataException(new Exception("Test Exception"), 0, null, dr);
                    }
                    catch (DataException e)
                    {
                        de = e;
                    }

                    Assert.NotNull(de);
                }
            }
        }
Exemplo n.º 2
0
 public void InitializeTest_NoType_Test()
 {
     using (var cmd = Execute.Command(DatabaseConfigurationContext.DefaultConnectionString))
     {
         cmd.CommandText = SingleStatment;
         cmd.CommandType = System.Data.CommandType.Text;
         using (var dr = new IndexedSqlDataReader(cmd.ExecuteReader()))
         {
         }
     }
 }
Exemplo n.º 3
0
 public void UsedAsHashKey_Test()
 {
     using (var cmd = Execute.Command(DatabaseConfigurationContext.DefaultConnectionString))
     {
         cmd.CommandText = SingleStatment;
         cmd.CommandType = System.Data.CommandType.Text;
         using (var dr = new IndexedSqlDataReader(cmd.ExecuteReader(), type: typeof(TestObject)))
         {
         }
     }
 }