public async Task Then_the_incentive_application_is_returned() { // Arrange var apps = _fixture.CreateMany <Models.IncentiveApplication>(3).ToList(); apps[0].Status = IncentiveApplicationStatus.Submitted; apps[0].Apprenticeships.First().EarningsCalculated = false; apps[1].Status = IncentiveApplicationStatus.ComplianceWithdrawn; apps[1].Apprenticeships.First().EarningsCalculated = false; apps[2].Status = IncentiveApplicationStatus.Submitted; foreach (var apprenticeship in apps[2].Apprenticeships) { apprenticeship.EarningsCalculated = true; } await _dbContext.AddRangeAsync(apps); await _dbContext.SaveChangesAsync(); // Act var actual = await _sut.FindApplicationsWithoutEarningsCalculated(); // Assert actual.Should().BeEquivalentTo(new[] { apps[0] }, opt => opt.ExcludingMissingMembers()); }
public async Task <List <IncentiveApplication> > FindIncentiveApplicationsWithoutEarningsCalculations() { var applications = await _incentiveApplicationDataRepository.FindApplicationsWithoutEarningsCalculated(); return((from app in applications select _incentiveApplicationFactory.GetExisting(app.Id, app)).ToList()); }