Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding mocking/testing support into the Future Extension Methods #198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

irkine
Copy link

@irkine irkine commented Feb 25, 2016

I am maintaining code that does extensive mocking of the DbContext in order to write a unit test suite. This works fairly well, but I was having issues when ".Future()" became a part of some queries... since the underlying context is a mock, it returns Lists .AsQuerable() ... which Future hard-stops on.

With this update, Future() can accommodate this testing scenario by allowing tests to inherit from one of two IFutureTestQueryable interfaces.

While I will likely use this modified version going forward, I thought the changes might be more generally useful.

Please let me know if you have any questions or concerns.

Russell West added 2 commits February 24, 2016 23:03
* Cleaning up extra error checking.
* Fixing spelling of 'Underlying'
* Adding 'test' Queryable interfaces: IFutureTestQueryable and
* IFutureTestQueryable<T>
* Adding a test hook to extension methods to return wrapped queryable when
* given an IQueryable that also inherits from one of the test interfaces.

These changes allow mocking and testing of code which uses the
FutureExtensionMethods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant