Inheritance: System.Data.Common.DbDataReader
Example #1
0
        public DbDataReaderTest()
        {
            //Setup test data table
            DataTable testData = new DataTable();
            testData.Columns.Add("text_col", typeof(string));
            testData.Columns.Add("binary_col", typeof(byte[]));

            testData.Rows.Add("row_1", new byte[] { 0xde, 0xad, 0xbe, 0xef });
            testData.Rows.Add("row_2", DBNull.Value);
            testData.Rows.Add("row_3", new byte[] { 0x00 });

            _dataReader = new DbDataReaderMock(testData);

            Assert.Equal(3, testData.Rows.Count);
        }
Example #2
0
        public DbDataReaderTest()
        {
            //Setup test data table
            DataTable testData = new DataTable();

            testData.Columns.Add("text_col", typeof(string));
            testData.Columns.Add("binary_col", typeof(byte[]));

            testData.Rows.Add("row_1", new byte[] { 0xde, 0xad, 0xbe, 0xef });
            testData.Rows.Add("row_2", DBNull.Value);
            testData.Rows.Add("row_3", new byte[] { 0x00 });

            _dataReader = new DbDataReaderMock(testData);

            Assert.Equal(3, testData.Rows.Count);
        }
Example #3
0
        public DbDataReaderTest()
        {
            // Setup test data table
            DataTable testData = new DataTable();

            testData.Columns.Add("text_col", typeof(string));
            testData.Columns.Add("binary_col", typeof(byte[]));
            testData.Columns.Add("boolean_col", typeof(bool));
            testData.Columns.Add("byte_col", typeof(byte));
            testData.Columns.Add("char_col", typeof(char));
            testData.Columns.Add("datetime_col", typeof(DateTime));
            testData.Columns.Add("decimal_col", typeof(decimal));
            testData.Columns.Add("double_col", typeof(double));
            testData.Columns.Add("float_col", typeof(float));
            testData.Columns.Add("guid_col", typeof(Guid));
            testData.Columns.Add("short_col", typeof(short));
            testData.Columns.Add("int_col", typeof(int));
            testData.Columns.Add("long_col", typeof(long));
            testData.Columns.Add("dbnull_col", typeof(object));

            var values = new object[14];

            values[0]  = ".NET";
            values[1]  = new byte[] { 0xDE, 0xAD, 0xBE, 0xEF };
            values[2]  = true;
            values[3]  = 0x00;
            values[4]  = 'E';
            values[5]  = new DateTime(2016, 6, 27);
            values[6]  = 810.72m;
            values[7]  = Math.PI;
            values[8]  = 776.90f;
            values[9]  = Guid.Parse("893e4fe8-299a-465a-a600-3cd4ad91629a");
            values[10] = 12345;
            values[11] = 1234567890;
            values[12] = 1234567890123456789;
            values[13] = DBNull.Value;

            testData.Rows.Add("row_1", new byte[] { 0xDE, 0xAD, 0xBE, 0xEF });
            testData.Rows.Add("row_2", DBNull.Value);
            testData.Rows.Add("row_3", new byte[] { 0x00 });
            testData.Rows.Add(values);

            _dataReader = new DbDataReaderMock(testData);

            Assert.Equal(4, testData.Rows.Count);
        }