Created
July 4, 2011 18:10
-
-
Save SlyNet/1063732 to your computer and use it in GitHub Desktop.
Faking the repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class RepositoryFakes | |
{ | |
public static IRepository<T> AsRepository<T>(this IList<T> list) where T : Entity | |
{ | |
IQueryable<T> queryable = list.AsQueryable(); | |
return Mock.Of<IRepository<T>>(x => x.Expression == queryable.Expression | |
&& x.ElementType == queryable.ElementType | |
&& x.Provider == queryable.Provider); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment