Custom list data source

Feb 10, 2011 at 6:00 PM

I've been using a custom data source that lets me quickly configure lists of items.  It looks like this:
   public class ListSource<T> : DatasourceBase<T>
      public ListSource(T[] items)
         this.items = items;
         random = new Random(1337);

      private readonly T[] items;
      private readonly Random random;

      public override T Next(IGenerationSession session)
         var index = random.Next(0, items.Length - 1);
         return items[index];

An example of usage is: 

 public class CornishTownSource : ListSource<string>
      #region Constructors

      public CornishTownSource()
         : base(new[]
           "St. Ives",

Is there any similar capability in the library as it stands?

Feb 26, 2011 at 9:05 PM

Nice one! Saves a lot of repetitive code when creating custom data sources!. Should definitely be added to the project