/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

  1. using Rhino.Etl.Core.Infrastructure;
  2. namespace Rhino.Etl.Tests.Dsl
  3. {
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using Core;
  7. using Xunit;
  8. using Rhino.Etl.Dsl;
  9. public class JoinFixture : BaseUserToPeopleTest
  10. {
  11. [Fact]
  12. public void CanCompile()
  13. {
  14. using(EtlProcess process = CreateDslInstance("Dsl/InnerJoin.boo"))
  15. Assert.NotNull(process);
  16. }
  17. [Fact]
  18. public void CanWriteJoinsToDatabase()
  19. {
  20. using(EtlProcess process = CreateDslInstance("Dsl/InnerJoin.boo"))
  21. process.Execute();
  22. List<string> roles = new List<string>();
  23. Use.Transaction("test", delegate(IDbCommand command)
  24. {
  25. command.CommandText = @"
  26. SELECT Roles FROM Users
  27. WHERE Roles IS NOT NULL
  28. ORDER BY Id
  29. ";
  30. using(IDataReader reader = command.ExecuteReader())
  31. while(reader.Read())
  32. {
  33. roles.Add(reader.GetString(0));
  34. }
  35. });
  36. Assert.Equal("ayende rahien is: admin, janitor, employee, customer", roles[0]);
  37. Assert.Equal("foo bar is: janitor", roles[1]);
  38. Assert.Equal("gold silver is: janitor, employee", roles[2]);
  39. }
  40. }
  41. }