/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

  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. public class SqlBulkInsertFixture : BaseUserToPeopleTest
  9. {
  10. [Fact]
  11. public void CanCompile()
  12. {
  13. using (EtlProcess process = CreateDslInstance("Dsl/UsersToPeopleBulk.boo"))
  14. Assert.NotNull(process);
  15. }
  16. [Fact]
  17. public void CanCopyTableWithTransform()
  18. {
  19. using (EtlProcess process = CreateDslInstance("Dsl/UsersToPeopleBulk.boo"))
  20. process.Execute();
  21. List<string[]> names = Use.Transaction<List<string[]>>("test", delegate(IDbCommand cmd)
  22. {
  23. List<string[]> tuples = new List<string[]>();
  24. cmd.CommandText = "SELECT firstname, lastname from people order by userid";
  25. using (IDataReader reader = cmd.ExecuteReader())
  26. {
  27. while (reader.Read())
  28. {
  29. tuples.Add(new string[] { reader.GetString(0), reader.GetString(1) });
  30. }
  31. }
  32. return tuples;
  33. });
  34. AssertNames(names);
  35. }
  36. }
  37. }