PageRenderTime 263ms CodeModel.GetById 120ms app.highlight 3ms RepoModel.GetById 138ms app.codeStats 0ms

/Rhino.Etl.Tests/Dsl/SqlBulkInsertFixture.cs

http://github.com/ayende/rhino-etl
C# | 42 lines | 37 code | 5 blank | 0 comment | 1 complexity | f3f91615eb4291e6d4f4fc966c3b8b82 MD5 | raw file
 1using Rhino.Etl.Core.Infrastructure;
 2
 3namespace Rhino.Etl.Tests.Dsl
 4{
 5    using System.Collections.Generic;
 6    using System.Data;
 7    using Core;
 8    using Xunit;
 9
10    
11    public class SqlBulkInsertFixture : BaseUserToPeopleTest
12    {
13        [Fact]
14        public void CanCompile()
15        {
16            using (EtlProcess process = CreateDslInstance("Dsl/UsersToPeopleBulk.boo"))
17                Assert.NotNull(process);
18        }
19
20        [Fact]
21        public void CanCopyTableWithTransform()
22        {
23            using (EtlProcess process = CreateDslInstance("Dsl/UsersToPeopleBulk.boo"))
24                process.Execute();
25
26            List<string[]> names = Use.Transaction<List<string[]>>("test", delegate(IDbCommand cmd)
27            {
28                List<string[]> tuples = new List<string[]>();
29                cmd.CommandText = "SELECT firstname, lastname from people order by userid";
30                using (IDataReader reader = cmd.ExecuteReader())
31                {
32                    while (reader.Read())
33                    {
34                        tuples.Add(new string[] { reader.GetString(0), reader.GetString(1) });
35                    }
36                }
37                return tuples;
38            });
39            AssertNames(names);
40        }
41    }
42}