Created
June 14, 2016 10:45
-
-
Save testfirstcoder/edd7a3561a8e9403395a136e4d32e2c7 to your computer and use it in GitHub Desktop.
Mock IQueryable with NSubstitute
This file contains 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 IQueryableMockExtensions | |
{ | |
public static void SetUp<T>(this T self, IQueryable queryable) where T : IQueryable | |
{ | |
self.GetEnumerator().Returns(queryable.GetEnumerator()); | |
self.ElementType.Returns(queryable.ElementType); | |
self.Expression.Returns(queryable.Expression); | |
self.Provider.Returns(queryable.Provider); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just found the gist on Google. Can you give any examples how to use them?