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

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