Exemplo n.º 1
0
        public async Task ReadXsvToEndAsyncTest()
        {
            using (var reader2 = new XsvReader(new StringReader(testData01)))
            {
                var rows = await reader2.ReadXsvToEndAsync(new[] { "," });

                foreach (var row in rows.Zip(expected01, (l, r) => new { expected = r, actual = l }))
                {
                    Console.WriteLine(row.actual.ConcatWith("|") + "\\n");
                    CollectionAssert.AreEqual((ICollection)row.expected, (ICollection)row.actual);
                }
            }
        }
Exemplo n.º 2
0
        static async Task ReadXsvAsync(XsvReader reader)
        {
            var currentId = System.Threading.Thread.CurrentThread.ManagedThreadId;

            Console.WriteLine("start:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
            var result = await reader.ReadXsvToEndAsync(new[] { "," });

            Console.WriteLine("end:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
            Console.WriteLine("current:" + currentId);
            foreach (var row in result)
            {
                Console.WriteLine(row.Select(s => s.MakeXsvField(new[] { "," })).ConcatWith(", "));
            }
        }