Does anyone know how I can parameterize following:
[Test]
void SelectTest(Expression<Func<MyType, bool>> where)
{
try
{
using (var db = new DataConnection("MyData"))
{
where = e => e.Status == Status.New;
var data = db.GetTable<MyType>()
.(where.Compile())
.Select(e => e);
Assert.IsNotEmpty(data);
}
}
catch (Exception)
{
Assert.False(true);
}
}
I tried adding a testcase like this:
[TestCase(e => e.Status == Status.New)]
But I'm getting the following error:
Expression cannot contain anonymous methods or lambda expressions.
What am I missing?
(I'm using linq2db and nunit)