I\'m working on making EF easier to unit test by writing some helpers that will make properties for me. I have a couple of backing fields
private Mock
If I understand your intention correctly - you can do it like this:
// no need to pass instance of T - why?
public Mock> Mocked() where T : class
{
if (typeof(T) == typeof(Workflow)) {
// first cast to object, then to return type to avoid compile error
// compiler does not know mockedWorkFlows is Mock>, but you
// know it already, because you checked type 'T'
return (Mock>) (object) mockedWorkFlows; //cannot Workflow to T
}
// etc
return null;
}
Whether it is good idea or not is a different story.