/Rhino.Etl.Tests/LoadTest/GenerateRandomIds.cs

http://github.com/ayende/rhino-etl · C# · 27 lines · 25 code · 2 blank · 0 comment · 1 complexity · 1febc7bc45e0f6ac77e3680c10178cf6 MD5 · raw file

  1. namespace Rhino.Etl.Tests.LoadTest
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using Core;
  6. using Rhino.Etl.Core.Operations;
  7. public class GenerateRandomIds : AbstractOperation
  8. {
  9. public GenerateRandomIds(int expectedCount)
  10. {
  11. this.expectedCount = expectedCount;
  12. }
  13. private readonly int expectedCount;
  14. public override IEnumerable<Row> Execute(IEnumerable<Row> rows)
  15. {
  16. for (int i = 0; i < expectedCount; i++)
  17. {
  18. Row row = new Row();
  19. row["old_id"] = i;
  20. row["new_id"] = Guid.NewGuid();
  21. yield return row;
  22. }
  23. }
  24. }
  25. }