romantitov / MockQueryable

Mocking Entity Framework Core operations such ToListAsync, FirstOrDefaultAsync etc
MIT License
785 stars 76 forks source link

Added example of how to use without mocking framework #56

Closed natehitze closed 2 years ago

natehitze commented 2 years ago

PR Details

Added extension method for IEnumerable<T> that simply returns new TestAsyncEnumerableEfCore<T> for the input enumerable.

Using TestAsyncEnumerableEfCore<T> directly instead of going through a mocking framework is much faster. See the related issue for benchmark and details. It should behave the same way since all BuildMock does is forward interface calls to the underlying TestAsyncEnumerableEfCore anyway.

Related Issue

55

How Has This Been Tested

New test class (MyServiceNoMockTests) with tests copied from MyServiceMoqTests converted to not use Moq.

Checklist