ToListAsync() returns empty list on second call
Hello, I am running into an issue where the ToListAsync() returns an empty list the second time it is called.
The issue can be easily reproduced by modifying one of the unit tests of your project, adding a second call to the GetAll() function:
[TestCase]
public async Task DbSetGetAllUserEntity()
{
//arrange
var users = CreateUserList();
var mock = users.AsQueryable().BuildMockDbSet();
var userRepository = new TestDbSetRepository(mock.Object);
//act
var result = await userRepository.GetAll();
result = await userRepository.GetAll();
//assert
Assert.AreEqual(users.Count, result.Count);
}
toListAsync works only when we have Where with an equal condition examples: ` await userRepository .ToListAsync(); // 2 times call, return results only for 1 call
await userRepository.Where(u => u.Id == 1) .ToListAsync(); // 2 times call, returns results always, works as expected
await userRepository.Where(u => u.Id > 0) .ToListAsync(); // return results only for 1 call `
Hello. Thanks for you contribution. Sorry for the late answer. Unfortunately I'm very busy at the moment. If you provide a pull request with fix of the issue I would be happy to include it to the next release. Please don't forget to cover the case by additional tests to minimize possibility of regressions for the future. Thanks for the understanding.
fixed in #74 Thanks @fischero19 Included to the release v7.0.1