ReadAll() публичный Метод

public ReadAll ( IDataTransformer transformer ) : IEnumerable
transformer IDataTransformer
Результат IEnumerable
Пример #1
0
        public void ReadAll_InputWithHeader_Ok()
        {
            string input = "Header#1;Header#2;Header#3\r\n1;2;3\r\n4;5;6";

            IDataTransformer transformer = new NullTransformerForAdapterTesting(
            new string[]
            {
                "Header#1",
                "Header#2",
                "Header#3"
            },
            new ArrayList()
            {
                new string[] {"1", "2", "3"},
                new string[] {"4", "5", "6"},
            });

            using (Dialect dialect = new Dialect(true, ';', '"', '\\', true, "\r\n", QuoteStyle.QUOTE_NONE, true, true))
            {
                using (CSVAdapter adapter = new CSVAdapter(dialect, new StringReader(input)))
                {
                    adapter.ReadAll(transformer);
                }
            }
        }
Пример #2
0
        public void ReadAll_ExistingFileName_ReturnsRecords()
        {
            IDataTransformer transformer = new NullTransformerForAdapterTesting(
                new[] { "Header#1", "Header#2", "Header#3" },
                new[]
                {
                    new[] {"1", "2", "3"},
                    new[] {"4", "5", "6"}
                });

            using (var dialect = new Dialect(true, ';', '"', '\\', true, "\r\n", QuoteStyle.QuoteNone, true, true))
            {
                using (var adapter = new CSVAdapter(dialect, "test.csv", "utf-8"))
                {
                    adapter.ReadAll(transformer);
                }
            }
        }
Пример #3
0
        public void ReadAll_ExistingStream_ReturnsRecords()
        {
            const string input = "Header#1;Header#2;Header#3\r\n1;2;3\r\n4;5;6";

            IDataTransformer transformer = new NullTransformerForAdapterTesting(
                new[] { "Header#1", "Header#2", "Header#3" },
                new[]
                {
                    new[] {"1", "2", "3"},
                    new[] {"4", "5", "6"}
                });

            using (var dialect = new Dialect(true, ';', '"', '\\', true, "\r\n", QuoteStyle.QuoteNone, true, true))
            {
                using (var adapter = new CSVAdapter(dialect, new StringReader(input)))
                {
                    adapter.ReadAll(transformer);
                }
            }
        }
Пример #4
0
        public void ReadAll_WithoutHeaders_ReturnRecords()
        {
            const string input = "1;2;3\r\n4;5;6";
            IDataTransformer transformer = new NullTransformerForAdapterTesting(
                null,
                new[]
                {
                    new[] {"1", "2", "3"},
                    new[] {"4", "5", "6"}
                });

            using (var dialect = new Dialect(true, ';', '"', '\\', true, "\r\n", QuoteStyle.QuoteNone, true, false))
            {
                using (var adapter = new CSVAdapter(dialect, new StringReader(input)))
                {
                    adapter.ReadAll(transformer);
                }
            }
        }