PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Rhino.Etl.Tests/Dsl/JoinFixture.cs

http://github.com/ayende/rhino-etl
C# | 45 lines | 41 code | 4 blank | 0 comment | 0 complexity | 87e49f331ebe85bfb9e1d46205c61249 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    using Rhino.Etl.Dsl;
10
11    
12    public class JoinFixture : BaseUserToPeopleTest
13    {
14        [Fact]
15        public void CanCompile()
16        {
17            using(EtlProcess process = CreateDslInstance("Dsl/InnerJoin.boo"))
18                Assert.NotNull(process);
19        }
20
21        [Fact]
22        public void CanWriteJoinsToDatabase()
23        {
24            using(EtlProcess process = CreateDslInstance("Dsl/InnerJoin.boo"))
25                process.Execute();
26            List<string> roles = new List<string>();
27            Use.Transaction("test", delegate(IDbCommand command)
28            {
29                command.CommandText = @"
30                                SELECT Roles FROM Users
31                                WHERE Roles IS NOT NULL
32                                ORDER BY Id
33                ";
34                using(IDataReader reader = command.ExecuteReader())
35                while(reader.Read())
36                {
37                    roles.Add(reader.GetString(0));
38                }
39            });
40            Assert.Equal("ayende rahien is: admin, janitor, employee, customer", roles[0]);
41            Assert.Equal("foo bar is: janitor", roles[1]);
42            Assert.Equal("gold silver is: janitor, employee", roles[2]);
43        }
44    }
45}