public static IEnumerable <T> CreateItems <T>(int amountOfItems, DataCreationStrategy <T> strategy = null) where T : new() { for (int i = 0; i < amountOfItems; i++) { yield return(strategy != null?strategy.GetValue() : new T()); } }
public override List <T> GetValue() { List <T> list = new List <T>(); int amount = 100; if (_amount > 0) { amount = _amount; } else if (_min > 0 && _max > 0 && _max > _min) { amount = _random.Next(_min, _max); } _embeddedStrategy.Reset(); for (int i = 0; i < amount; i++) { list.Add(_embeddedStrategy.GetValue()); } return(list); }
public static T CreateItem <T>(DataCreationStrategy <T> strategy) { return(strategy.GetValue()); }