Closed d1820 closed 4 months ago
I create a mockObject and when i apply the where condition with a FirstOrDefaultAsync is does not actually filter the data.
var data = new List<MyItem>{ new MyItem {Id = {guid}, new MyItem {Id = {guid2}, }.BuildMock(); _myRepo.Setup(f => f.GetAsNoTracking(It.IsAny<Expression<Func<MyItem, bool>>>(), null, "")).Returns(() => data); result = _myRepo.GetAsNoTracking(f => f.Id == {guid2}) .FirstOrDefaultAsync(); function GetAsNoTracking(Expression<Func<TEntity, bool>>? filter = null){ IQueryable<TEntity> query = _dbSet; if (asNoTracking) { query = query.AsNoTracking(); } if (filter != null) { query = query.Where(filter); } }
Am i missing how this works? My understanding was it will actually filter the in-memory data sets
I create a mockObject and when i apply the where condition with a FirstOrDefaultAsync is does not actually filter the data.
Am i missing how this works? My understanding was it will actually filter the in-memory data sets