romantitov / MockQueryable

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

Value cannot be null. (Parameter 'arg0') on CountAsync MockQueryable Core #21

Closed johnbyronent closed 5 years ago

johnbyronent commented 5 years ago

Hi

I'm using the MockQueryable.Core 3.0.1

I'm trying to a CountAsync on TestAsyncEnumerable and get a Value cannot be null. (Parameter 'arg0')

UnitTest.zip

Normal enumeration does work.

I've included a sample

romantitov commented 5 years ago

TestAsyncEnumerable from MockQueryable.Core required proper initialization. That's why I made packages for Moq, NSubstitute or FakeItEasy. I would recommend you to use one of these packages You can see example of the initialization here. In samples you can find example of testing CountAsync