PageRenderTime 28ms CodeModel.GetById 11ms app.highlight 10ms RepoModel.GetById 2ms app.codeStats 0ms

/Rhino.Etl.Tests/Dsl/DatabaseToDatabaseWithTransformFixture.cs

http://github.com/ayende/rhino-etl
C# | 42 lines | 37 code | 5 blank | 0 comment | 1 complexity | 503f557f377fec61d8f160f79f843052 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 DatabaseToDatabaseWithTransformFixture : BaseUserToPeopleTest
12    {
13        [Fact]
14        public void CanCompile()
15        {
16            using(EtlProcess process = CreateDslInstance("Dsl/UsersToPeople.boo"))
17                Assert.NotNull(process);
18        }
19
20        [Fact]
21        public void CanCopyTableWithTransform()
22        {
23            using(EtlProcess process = CreateDslInstance("Dsl/UsersToPeople.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}