public async Task GettingAllRecords_WithPageInformation_ReturnsExpectedNumberOfRecords( int currentPage, int pageSize, int expected) { // Arrange var pageInformation = new PageInformation(currentPage, pageSize); var insolvencyRecords = InsolvenciesTestData.CreateInsolvenciesActuals(); var personRecords = PersonsTestData.CreatePersonsActuals(); var context = TestDbContext.CreateContextWithSeededData(insolvencyRecords).Seed(personRecords); var personRepository = new InsolvencyOrderPersonsRepository(context, mockTelemetryClient.Object); // Act var actualCount = (await personRepository.GetAllAsync(pageInformation)).Count(); // Assert Assert.AreEqual(expected, actualCount); }
public async Task GettingAllRecords_WithSeededPersonsRecords_ReturnsMappedModels() { // Arrange var pageInformation = new PageInformation(1, 100); var expectedRecords = PersonsTestData.CreatePersonsExpecteds(); var insolvencyRecords = InsolvenciesTestData.CreateInsolvenciesActuals(); var personRecords = PersonsTestData.CreatePersonsActuals(); var context = TestDbContext.CreateContextWithSeededData(insolvencyRecords).Seed(personRecords); var personRepository = new InsolvencyOrderPersonsRepository(context, mockTelemetryClient.Object); // Act var actualRecords = await personRepository.GetAllAsync(pageInformation); // Assert CollectionAssert.AreEqual( expectedRecords.OrderBy(x => x.InsolvencyOrderPersonId).ToList(), actualRecords.OrderBy(x => x.InsolvencyOrderPersonId).ToList(), new InsolvencyPersonModelComparer()); }