Skip to content

Instantly share code, notes, and snippets.

@k0stya
Created May 15, 2013 18:20
Show Gist options
  • Save k0stya/5586104 to your computer and use it in GitHub Desktop.
Save k0stya/5586104 to your computer and use it in GitHub Desktop.
SpecFlow CreateSimpleSet
namespace TechTalk.SpecFlow
{
public static class SpecFlowExt
{
public static IEnumerable<T> CreateSimpleSet<T>(this Table table, string colName = null)
{
if (table.Rows.Count == 0)
{
throw new ApplicationException("Input table is empty");
}
if (typeof (T).IsEnum)
{
return table.Rows.Select(r => (T)Enum.Parse(typeof(T), colName == null ? r[0] : r[colName])).ToList();
}
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment