Skip to content

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
Development

Successfully merging this pull request may close these issues.

1 participant