We are trying to figure out what the point of unit testing is for basic cases as in the code below. Does making a unit test for this beneficial ? We are not trying to test the entity framework. We just want to make sure the lambda expression does what it should... Our idea is that we will use DI to pass in SOMETHING that is IQueryable.. In practice it will be EF but for unit tests and will be POCO objects/collections. Does this makes sense ? We are just getting started and want to master the concepts before we get beyond this basic code.
public class CongressRepository
{
CongressDb_DevEntities context = new CongressDb_DevEntities();
CongressRepository(DbContext db)
{
context = (CongressDb_DevEntities) db;
}
public IQueryable<tMember> GetAllMembers
{
get { return context.tMembers; }
}
public IQueryable<tMember> GetVotingMembers
{
get { return context.tMembers.Where(x => x.age > 18); }
}
}