Пример #1
0
        private void WriteHeaderLine(ConcurrentSqlExtractor reader, ConcurrentFlatFileWriter writer)
        {
            var           HeaderLineObject = reader.GetDataTable();
            StringBuilder builder          = new StringBuilder();
            int           count            = HeaderLineObject.Rows.Count;
            string        delim            = m_Context.Delimiter;

            for (int i = 0; i < count - 1; i++)
            {
                builder.Append(HeaderLineObject.Rows[i]["ColumnName"]);
                builder.Append(delim);
            }
            builder.Append(HeaderLineObject.Rows[count - 1]["ColumnName"]);
            writer.WriteLine(builder.ToString());
        }
        public void GetDataTableTest()
        {
            try
            {
                CreateTestTable();

                ConcurrentSqlExtractor reader = new ConcurrentSqlExtractor(context);
                var result = reader.GetDataTable();
                Assert.AreEqual(expected: 3, actual: result.Rows.Count);
                Assert.AreEqual(expected: "col1", actual: result.Rows[0]["ColumnName"]);
            }
            finally
            {
                DestroyTestTable();
            }
        }