@@ -171,33 +171,36 @@ public async Task GetPaginatedEntitiesAsync()
171
171
await dbContext . Database . EnsureDeletedAsync ( ) ;
172
172
await dbContext . Database . EnsureCreatedAsync ( ) ;
173
173
174
- var query = await repository . GetAllAsync ( includes : q => q . Include ( p => p . Indirizzo ) , filter : w => w . Id <= 10 ) ;
175
- var entities = await repository . GetPaginatedAsync ( query , 2 , 5 ) ;
174
+ //var query = await repository.GetAllAsync(includes: q => q.Include(p => p.Indirizzo), filter: w => w.Id <= 10);
175
+ //var entities = await repository.GetPaginatedAsync(query, 2, 5);
176
+
177
+ var entities = await repository . GetAllPagingAsync ( pageNumber : 2 , pageSize : 5 , includes : q => q . Include ( p => p . Indirizzo ) , filter : w => w . Id <= 10 ) ;
176
178
var itemCount = entities . Items . Count ;
177
179
178
180
Assert . NotNull ( entities ) ;
179
181
Assert . Equal ( 5 , itemCount ) ;
180
- Assert . Contains ( query , x => x . Id == 8 ) ;
182
+ Assert . Contains ( entities . Items , x => x . Id == 8 ) ;
181
183
}
182
184
183
- [ Fact ]
184
- public async Task GetPaginatedEntitiesWithoutIncludeAsync ( )
185
- {
186
- using var dbContext = GetDbContext ( ) ;
187
- var repository = new Repository < Persone , int > ( dbContext ) ;
185
+ // [Fact]
186
+ // public async Task GetPaginatedEntitiesWithoutIncludeAsync()
187
+ // {
188
+ // using var dbContext = GetDbContext();
189
+ // var repository = new Repository<Persone, int>(dbContext);
188
190
189
- await dbContext . Database . EnsureDeletedAsync ( ) ;
190
- await dbContext . Database . EnsureCreatedAsync ( ) ;
191
+ // await dbContext.Database.EnsureDeletedAsync();
192
+ // await dbContext.Database.EnsureCreatedAsync();
191
193
192
- var query = await repository . GetAllAsync ( includes : q => q . Include ( p => p . Indirizzo ) , filter : w => w . Id <= 10 ) ;
194
+ // //var query = await repository.GetAllAsync(includes: q => q.Include(p => p.Indirizzo), filter: w => w.Id <= 10);
195
+ // //var entities = await repository.GetPaginatedAsync(query, 2, 5);
193
196
194
- var entities = await repository . GetPaginatedAsync ( query , 2 , 5 ) ;
195
- var itemCount = entities . Items . Count ;
197
+ // var entities = await repository.GetAllPagingAsync(pageNumber: 2, pageSize: 5, includes: q => q.Include(p => p.Indirizzo), filter: w => w.Id <= 10 );
198
+ // var itemCount = entities.Items.Count;
196
199
197
- Assert . NotNull ( entities ) ;
198
- Assert . Equal ( 5 , itemCount ) ;
199
- Assert . Contains ( query , x => x . Id == 8 ) ;
200
- }
200
+ // Assert.NotNull(entities);
201
+ // Assert.Equal(5, itemCount);
202
+ // Assert.Contains(entities.Items , x => x.Id == 8);
203
+ // }
201
204
202
205
[ Fact ]
203
206
public async Task GetPaginatedEntitiesWithoutWhereAsync ( )
@@ -208,14 +211,15 @@ public async Task GetPaginatedEntitiesWithoutWhereAsync()
208
211
await dbContext . Database . EnsureDeletedAsync ( ) ;
209
212
await dbContext . Database . EnsureCreatedAsync ( ) ;
210
213
211
- var query = await repository . GetAllAsync ( includes : q => q . Include ( p => p . Indirizzo ) , filter : null ! , orderBy : x => x . Id ) ;
214
+ //var query = await repository.GetAllAsync(includes: q => q.Include(p => p.Indirizzo), filter: null!, orderBy: x => x.Id);
215
+ //var entities = await repository.GetPaginatedAsync(query, 1, 5);
212
216
213
- var entities = await repository . GetPaginatedAsync ( query , 1 , 5 ) ;
217
+ var entities = await repository . GetAllPagingAsync ( pageNumber : 1 , pageSize : 5 , includes : q => q . Include ( p => p . Indirizzo ) , orderBy : x => x . Id ) ;
214
218
var itemCount = entities . Items . Count ;
215
219
216
220
Assert . NotNull ( entities ) ;
217
221
Assert . Equal ( 5 , itemCount ) ;
218
- Assert . Contains ( query , x => x . Id == 3 ) ;
222
+ Assert . Contains ( entities . Items , x => x . Id == 3 ) ;
219
223
}
220
224
221
225
[ Fact ]
@@ -227,15 +231,17 @@ public async Task GetPaginatedEntitiesDescendingOrderTypeAsync()
227
231
await dbContext . Database . EnsureDeletedAsync ( ) ;
228
232
await dbContext . Database . EnsureCreatedAsync ( ) ;
229
233
230
- var query = await repository . GetAllAsync ( includes : q => q . Include ( p => p . Indirizzo ) , filter : null ! , orderBy : x => x . Id , ascending : false ) ;
234
+ //var query = await repository.GetAllAsync(includes: q => q.Include(p => p.Indirizzo), filter: null!, orderBy: x => x.Id, ascending: false);
235
+ //var entities = await repository.GetPaginatedAsync(query, 1, 5);
231
236
232
- var entities = await repository . GetPaginatedAsync ( query , 1 , 5 ) ;
237
+ var entities = await repository . GetAllPagingAsync ( pageNumber : 1 , pageSize : 5 , includes : q => q . Include ( p => p . Indirizzo ) , orderBy : x => x . Id , ascending : false ) ;
233
238
var itemCount = entities . Items . Count ;
234
239
235
240
Assert . NotNull ( entities ) ;
236
241
Assert . Equal ( 5 , itemCount ) ;
237
242
Assert . Equal ( 10 , Assert . IsType < Persone > ( entities . Items . First ( ) ) . Id ) ;
238
- Assert . Contains ( query , x => x . Id == 8 ) ;
243
+ //Assert.Contains(query, x => x.Id == 8);
244
+ Assert . Contains ( entities . Items , x => x . Id == 8 ) ;
239
245
}
240
246
241
247
[ Fact ]
0 commit comments