>Suppose I have a generic method that returns a generic list, code shows how you can do that.
public List<T> GetAll<T>() where T : class
{
List<T> result;
if (typeof(T) == typeof(MyObject))
{
result = new List<T>
{
new MyObject()
{
name = “ObjectName1”,
id = 1
} as T,
new MyObject()
{
name = “ObjectName2”,
id = 2
} as T,
};
return result;
}
else //You can add other objects here if you’re using it in your Repository Test
{
return new List<T>();
}
}