Skip to content

Commit

Permalink
Updates after review
Browse files Browse the repository at this point in the history
  • Loading branch information
FirestarJes committed Oct 30, 2024
1 parent a839555 commit e66ac92
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ public interface ISettlementReportRepository

Task<IEnumerable<SettlementReport>> GetForJobsAsync(Guid actorId);

Task<IEnumerable<SettlementReport>> GetNeedsNotificationSentForCompletedAndFailed();
Task<IEnumerable<SettlementReport>> GetPendingNotificationsForCompletedAndFailed();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
using Microsoft.Extensions.Hosting;

var host = new HostBuilder()
.ConfigureFunctionsWebApplication(worker =>
{
// Http => Authentication
worker.UseUserMiddlewareForIsolatedWorker<FrontendUser>();
})
.ConfigureFunctionsWebApplication()
.ConfigureServices((context, services) =>
{
// Common
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public IntegrationEventProvider(ISettlementReportRepository settlementReportRepo
public async IAsyncEnumerable<IntegrationEvent> GetAsync()
{
var reportsForNotifications = await _settlementReportRepository
.GetNeedsNotificationSentForCompletedAndFailed()
.GetPendingNotificationsForCompletedAndFailed()
.ConfigureAwait(false);

foreach (var reportForNotification in reportsForNotifications)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task DeleteAsync(Application.SettlementReports_v2.SettlementReport
.ConfigureAwait(false);
}

public async Task<IEnumerable<Application.SettlementReports_v2.SettlementReport>> GetNeedsNotificationSentForCompletedAndFailed()
public async Task<IEnumerable<Application.SettlementReports_v2.SettlementReport>> GetPendingNotificationsForCompletedAndFailed()
{
return await _context.SettlementReports
.Where(x => x.IsNotificationSent == false && (x.Status == SettlementReportStatus.Completed || x.Status == SettlementReportStatus.Failed))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ await PrepareNewRequestAsync(requestFilterDto =>
var repository = new SettlementReportRepository(context);

// act
var actual = (await repository.GetNeedsNotificationSentForCompletedAndFailed()).ToList();
var actual = (await repository.GetPendingNotificationsForCompletedAndFailed()).ToList();

// assert
Assert.Empty(actual);
Expand All @@ -348,7 +348,7 @@ public async Task GetForNotificationAsync_ReturnsCorrect_WhenTheyArePresent()
request.MarkAsCompleted(SystemClock.Instance, new GeneratedSettlementReportDto(new SettlementReportRequestId(request.Id.ToString()), "test.zip", []));
return request;
});
await PrepareNewRequestAsync(requestFilterDto =>
var alreadySent = await PrepareNewRequestAsync(requestFilterDto =>
{
var request = new SettlementReport.Application.SettlementReports_v2.SettlementReport(
SystemClock.Instance,
Expand All @@ -366,11 +366,15 @@ await PrepareNewRequestAsync(requestFilterDto =>
var repository = new SettlementReportRepository(context);

// act
var actual = (await repository.GetNeedsNotificationSentForCompletedAndFailed()).ToList();
var actual = (await repository.GetPendingNotificationsForCompletedAndFailed()).ToList();
var actualSent = await repository.GetAsync(alreadySent.RequestId);

// assert
Assert.Single(actual);
Assert.NotNull(actualSent);
Assert.Equal(expected.Id, actual[0].Id);
Assert.False(actual[0].IsNotificationSent);
Assert.True(actualSent.IsNotificationSent);
}

private async Task<SettlementReport.Application.SettlementReports_v2.SettlementReport> PrepareNewRequestAsync(Func<SettlementReportRequestFilterDto, SettlementReport.Application.SettlementReports_v2.SettlementReport>? createReport = null)
Expand Down

0 comments on commit e66ac92

Please sign in to comment.