From ba97e3e9235b1f75e7131f4b6b2940c0be2ccd61 Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Fri, 12 Jun 2026 13:18:15 +0100 Subject: [PATCH 1/6] WIP --- .../Services/ApprenticeshipDomainService.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs index 776dfc9d6..1a1379b1f 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs @@ -50,6 +50,14 @@ public async Task> GetEmployerAlertSummar .GroupBy(app => app.Cohort.EmployerAccountId) .Select(m => new { EmployerAccountId = m.Key, ChangesForReviewCount = m.Count() }); + var pendingIlrChangeOfCircs = dbContext.Value.ApprovalRequests + .Where(ar => ar.Status == CocApprovalResultStatus.Pending) + .Join(dbContext.Value.Apprenticeships, ar => ar.ApprenticeshipId, app => app.Id, (ar, app) => new { ar, app }) + .GroupBy(app => app.app.Cohort.EmployerAccountId) + .Select(m => new { EmployerAccountId = m.Key, PendingChangesForReviewCount = m.Count() }); + + + var pendingUpdateByProvider = await queryPendingUpdateByProvider.ToDictionaryAsync(p => p.EmployerAccountId, p => p.PendingUpdateByProviderCount); var courseTriaged = await queryCourseTriaged.ToDictionaryAsync(p => p.EmployerAccountId, p => p.RestartRequestCount); var priceTriaged = await queryPriceTriaged.ToDictionaryAsync(p => p.EmployerAccountId, p => p.ChangesForReviewCount); From 24f3f7004655cb26d34013dbcda94e2921c151ad Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Wed, 17 Jun 2026 17:00:32 +0100 Subject: [PATCH 2/6] Update code and adjusted tests --- .../EmployerAlertSummaryEmailServiceTests.cs | 90 ++++++++----------- .../CommitmentsV2Configuration.cs | 1 + .../EmployerAlertSummaryNotification.cs | 1 + .../Services/ApprenticeshipDomainService.cs | 14 +-- .../EmployerAlertSummaryEmailService.cs | 40 ++++++--- 5 files changed, 74 insertions(+), 72 deletions(-) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs index f8ca14bc5..eabe725fa 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs @@ -105,11 +105,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIRST ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", $"* 1 apprentice with changes for review" }, { "requested_changes", "" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -148,11 +147,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIRST ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", $"* 1 apprentice with changes for review" }, { "requested_changes", "" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -191,11 +189,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIRST ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -234,11 +231,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIRST ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -277,11 +273,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIRST ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -320,11 +315,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIRST ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -423,11 +417,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "ONE ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", $"* 1 apprentice with changes for review" }, { "requested_changes", "" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } }, @@ -438,11 +431,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "TWO ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", $"* 1 apprentice with changes for review" }, { "requested_changes", "" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1002/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1002/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1002" } } }, @@ -453,11 +445,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "THREE ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1003" } } }, @@ -468,11 +459,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FOUR ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1004/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1004/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1004" } } }, @@ -483,11 +473,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "is 1 apprentice" }, - { "account_name", "FIVE ACCOUNT" }, - { "need_needs", "needs" }, { "changes_for_review", "" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1005" } } }, @@ -498,11 +487,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "are 2 apprentices" }, - { "account_name", "SIX ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", "" }, { "requested_changes", $"* 2 apprentices with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1006" } } }, @@ -513,11 +501,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "are 3 apprentices" }, - { "account_name", "SEVEN ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", $"* 2 apprentices with changes for review" }, { "requested_changes", $"* 1 apprentice with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1007/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1007/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1007" } } } @@ -556,11 +543,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "are 2 apprentices" }, - { "account_name", "SIX ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", "" }, { "requested_changes", $"* 2 apprentices with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1006" } } } @@ -619,11 +605,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "are 2 apprentices" }, - { "account_name", "ONE ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", $"* 2 apprentices with changes for review" }, { "requested_changes", "" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } }, @@ -634,11 +619,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "are 2 apprentices" }, - { "account_name", "THREE ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", $"* 2 apprentices with changes for review" }, { "requested_changes", "" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1003" } } }, @@ -649,11 +633,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", "are 2 apprentices" }, - { "account_name", "FIVE ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", "" }, { "requested_changes", $"* 2 apprentices with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1005" } } } @@ -692,11 +675,10 @@ public IEnumerator GetEnumerator() Tokens = new Dictionary { { "total_count_text", $"are 6 apprentices" }, - { "account_name", "ONE ACCOUNT" }, - { "need_needs", "need" }, { "changes_for_review", $"* 4 apprentices with changes for review" }, { "requested_changes", $"* 2 apprentices with requested changes" }, - { "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, + { "ilrchanges_to_confirm", "" }, + //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } } diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/CommitmentsV2Configuration.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/CommitmentsV2Configuration.cs index 0aa2def5f..61e9264bc 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/CommitmentsV2Configuration.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Configuration/CommitmentsV2Configuration.cs @@ -29,4 +29,5 @@ public class CommitmentsV2Configuration public bool IgnoreShortCourses { get; set; } public string ReplayApprenticeshipCreatedEventsJobSchedule { get; set; } public bool ReplayApprenticeshipCreatedEventsDryRun { get; set; } = true; + public bool CoCApprovalsActive { get; set; } } \ No newline at end of file diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/EmployerAlertSummaryNotification.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/EmployerAlertSummaryNotification.cs index 7a9cdcf6a..cee740d55 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/EmployerAlertSummaryNotification.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/EmployerAlertSummaryNotification.cs @@ -6,4 +6,5 @@ public class EmployerAlertSummaryNotification public int TotalCount { get; set; } public int ChangesForReviewCount { get; set; } public int RestartRequestCount { get; set; } + public int PendingIlrChangesCount { get; set; } } \ No newline at end of file diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs index 1a1379b1f..5e4b98712 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/ApprenticeshipDomainService.cs @@ -56,20 +56,24 @@ public async Task> GetEmployerAlertSummar .GroupBy(app => app.app.Cohort.EmployerAccountId) .Select(m => new { EmployerAccountId = m.Key, PendingChangesForReviewCount = m.Count() }); - - var pendingUpdateByProvider = await queryPendingUpdateByProvider.ToDictionaryAsync(p => p.EmployerAccountId, p => p.PendingUpdateByProviderCount); var courseTriaged = await queryCourseTriaged.ToDictionaryAsync(p => p.EmployerAccountId, p => p.RestartRequestCount); var priceTriaged = await queryPriceTriaged.ToDictionaryAsync(p => p.EmployerAccountId, p => p.ChangesForReviewCount); + var pendingIlrChanges = await pendingIlrChangeOfCircs.ToDictionaryAsync(p => p.EmployerAccountId, p => p.PendingChangesForReviewCount); - var results = pendingUpdateByProvider.Select(p => p.Key).Union(courseTriaged.Select(p => p.Key).Union(priceTriaged.Select(p => p.Key))) + var results = pendingUpdateByProvider.Select(p => p.Key) + .Union(courseTriaged.Select(p => p.Key) + .Union(priceTriaged.Select(p => p.Key)) + .Union(pendingIlrChanges.Select(p => p.Key))) .Distinct() .Select(p => new EmployerAlertSummaryNotification { EmployerHashedAccountId = encodingService.Encode(p, EncodingType.AccountId), - TotalCount = pendingUpdateByProvider.GetValueOrDefault(p, 0) + priceTriaged.GetValueOrDefault(p, 0) + courseTriaged.GetValueOrDefault(p, 0), + TotalCount = pendingUpdateByProvider.GetValueOrDefault(p, 0) + priceTriaged.GetValueOrDefault(p, 0) + + courseTriaged.GetValueOrDefault(p, 0) + pendingIlrChanges.GetValueOrDefault(p, 0), ChangesForReviewCount = pendingUpdateByProvider.GetValueOrDefault(p, 0) + priceTriaged.GetValueOrDefault(p, 0), - RestartRequestCount = courseTriaged.GetValueOrDefault(p, 0) + RestartRequestCount = courseTriaged.GetValueOrDefault(p, 0), + PendingIlrChangesCount = pendingIlrChanges.GetValueOrDefault(p, 0) }) .ToList(); diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs index 264bdd46b..f88277910 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs @@ -48,32 +48,31 @@ public async Task SendEmployerAlertSummaryNotifications() .Where(response => response != null) .ToList(); - accounts.ForEach(x => + accounts.ForEach(async x => { var alertSummary = employerAlertSummaryNotifications.Single(a => a.EmployerHashedAccountId == x.HashedAccountId); - SendEmail(alertSummary, x.AccountId, x.HashedAccountId, x.DasAccountName); + await SendEmail(alertSummary, x.AccountId, x.HashedAccountId); }); } - private void SendEmail(EmployerAlertSummaryNotification alertSummary, long accountId, string hashedAccountId, string accountName) + private async Task SendEmail(EmployerAlertSummaryNotification alertSummary, long accountId, string hashedAccountId) { var tokens = new Dictionary { { "total_count_text", alertSummary.TotalCount == 1 - ? "is 1 apprentice" - : $"are {alertSummary.TotalCount} apprentices" + ? "You have 1 item that needs your attention" + : $"You have {alertSummary.TotalCount} items that need your attention" }, - { "account_name", accountName }, - { "need_needs", alertSummary.TotalCount > 1 ? "need" : "needs" }, { "changes_for_review", ChangesForReviewText(alertSummary.ChangesForReviewCount) }, { "requested_changes", RestartRequestText(alertSummary.RestartRequestCount) }, - { "link_to_mange_apprenticeships", $"{_commitmentsV2Configuration.EmployerCommitmentsBaseUrl}/{hashedAccountId}/apprentices" }, + { "ilrchanges_to_confirm", IlrChangesToConfirmText(alertSummary.PendingIlrChangesCount) }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/{hashedAccountId}" } }; - _messageSession.Send(new SendEmailToEmployerCommand(accountId, "EmployerAlertSummaryNotification", tokens, null, "name")); + await _messageSession.Send(new SendEmailToEmployerCommand(accountId, "EmployerAlertSummaryNotification", tokens, null, "name")); } private static string RestartRequestText(int restartRequestCount) @@ -81,8 +80,8 @@ private static string RestartRequestText(int restartRequestCount) return restartRequestCount switch { 0 => string.Empty, - 1 => $"* {restartRequestCount} apprentice with requested changes", - _ => $"* {restartRequestCount} apprentices with requested changes" + 1 => $"* {restartRequestCount} learner request to review", + _ => $"* {restartRequestCount} learner requests to review", }; } @@ -91,8 +90,23 @@ private static string ChangesForReviewText(int changesForReview) return changesForReview switch { 0 => string.Empty, - 1 => $"* {changesForReview} apprentice with changes for review", - _ => $"* {changesForReview} apprentices with changes for review" + 1 => $"* {changesForReview} learner with changes for review", + _ => $"* {changesForReview} learners with changes for review" + }; + } + + private string IlrChangesToConfirmText(int changestoConfirm) + { + if(!_commitmentsV2Configuration.CoCApprovalsActive) + { + return string.Empty; + } + + return changestoConfirm switch + { + 0 => string.Empty, + 1 => $"* {changestoConfirm} learner with changes from ILR to confirm", + _ => $"* {changestoConfirm} learners with changes from ILR to confirm", }; } From 1619d7f81d20fafd4d83ee156cb9830db44957ce Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Thu, 18 Jun 2026 14:35:02 +0100 Subject: [PATCH 3/6] fix tests --- .../EmployerAlertSummaryEmailServiceTests.cs | 236 +++++------------- .../EmployerAlertSummaryEmailService.cs | 2 +- 2 files changed, 57 insertions(+), 181 deletions(-) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs index eabe725fa..5125ce4dc 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs @@ -74,48 +74,6 @@ public IEnumerator GetEnumerator() }; #endregion - #region single provider notification - yield return new object[] - { - new Input - { - EmployerAlertSummaryNotifications = new List - { - new EmployerAlertSummaryNotification - { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 - } - }, - AccountResponses = new List - { - new AccountResponse - { - AccountId = 1000, - HashedAccountId = "HSH1000", - DasAccountName = "FIRST ACCOUNT" - } - } - }, - new List - { - new Output - { - AccountId = 1000, - HashedAccountId = "HSH1000", - Tokens = new Dictionary - { - { "total_count_text", "is 1 apprentice" }, - { "changes_for_review", $"* 1 apprentice with changes for review" }, - { "requested_changes", "" }, - { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, - { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } - } - } - } - }; - #endregion - #region single price triage notification yield return new object[] { @@ -125,7 +83,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0 } }, AccountResponses = new List @@ -146,8 +104,8 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1000", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, - { "changes_for_review", $"* 1 apprentice with changes for review" }, + { "total_count_text", "You have 1 item that needs your attention" }, + { "changes_for_review", $"* 1 learner with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, @@ -167,7 +125,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 } }, AccountResponses = new List @@ -188,9 +146,9 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1000", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, + { "total_count_text", "You have 1 item that needs your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, + { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } @@ -200,7 +158,7 @@ public IEnumerator GetEnumerator() }; #endregion - #region single course triage notification + #region single Pending ILR CoC notification yield return new object[] { new Input @@ -209,7 +167,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 0, PendingIlrChangesCount = 1 } }, AccountResponses = new List @@ -230,52 +188,10 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1000", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, + { "total_count_text", "You have 1 item that needs your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, - { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, - { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } - } - } - } - }; - #endregion - - #region single course triage notification - yield return new object[] - { - new Input - { - EmployerAlertSummaryNotifications = new List - { - new EmployerAlertSummaryNotification - { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 - } - }, - AccountResponses = new List - { - new AccountResponse - { - AccountId = 1000, - HashedAccountId = "HSH1000", - DasAccountName = "FIRST ACCOUNT" - } - } - }, - new List - { - new Output - { - AccountId = 1000, - HashedAccountId = "HSH1000", - Tokens = new Dictionary - { - { "total_count_text", "is 1 apprentice" }, - { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, - { "ilrchanges_to_confirm", "" }, + { "requested_changes", "" }, + { "ilrchanges_to_confirm", "* 1 learner with changes from ILR to confirm" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } @@ -284,47 +200,6 @@ public IEnumerator GetEnumerator() }; #endregion - #region single course triage notification - yield return new object[] - { - new Input - { - EmployerAlertSummaryNotifications = new List - { - new EmployerAlertSummaryNotification - { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 - } - }, - AccountResponses = new List - { - new AccountResponse - { - AccountId = 1000, - HashedAccountId = "HSH1000", - DasAccountName = "FIRST ACCOUNT" - } - } - }, - new List - { - new Output - { - AccountId = 1000, - HashedAccountId = "HSH1000", - Tokens = new Dictionary - { - { "total_count_text", "is 1 apprentice" }, - { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, - { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, - { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } - } - } - } - }; - #endregion #region multiple notifications yield return new object[] @@ -335,31 +210,31 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1001", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1001", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1002", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1002", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1003", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1003", TotalCount = 3, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 2 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1004", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1004", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1005", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1005", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1006", TotalCount = 4, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 2 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1007", TotalCount = 3, ChangesForReviewCount = 2, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1007", TotalCount = 4, ChangesForReviewCount = 2, RestartRequestCount = 1, PendingIlrChangesCount = 1 } }, AccountResponses = new List @@ -416,8 +291,8 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1001", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, - { "changes_for_review", $"* 1 apprentice with changes for review" }, + { "total_count_text", "You have 1 item that needs your attention" }, + { "changes_for_review", $"* 1 learner with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, @@ -430,8 +305,8 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1002", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, - { "changes_for_review", $"* 1 apprentice with changes for review" }, + { "total_count_text", "You have 1 item that needs your attention" }, + { "changes_for_review", $"* 1 learner with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1002/apprentices" }, @@ -444,10 +319,10 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1003", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, + { "total_count_text", "You have 3 items that need your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, - { "ilrchanges_to_confirm", "" }, + { "requested_changes", $"* 1 learner request to review" }, + { "ilrchanges_to_confirm", "* 2 learners with changes from ILR to confirm" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1003" } } @@ -458,9 +333,9 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1004", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, + { "total_count_text", "You have 1 item that needs your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, + { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1004/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1004" } @@ -472,9 +347,9 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1005", Tokens = new Dictionary { - { "total_count_text", "is 1 apprentice" }, + { "total_count_text", "You have 1 item that needs your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, + { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1005" } @@ -486,10 +361,10 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1006", Tokens = new Dictionary { - { "total_count_text", "are 2 apprentices" }, + { "total_count_text", "You have 4 items that need your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 2 apprentices with requested changes" }, - { "ilrchanges_to_confirm", "" }, + { "requested_changes", $"* 2 learner requests to review" }, + { "ilrchanges_to_confirm", "* 2 learners with changes from ILR to confirm" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1006" } } @@ -500,10 +375,10 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1007", Tokens = new Dictionary { - { "total_count_text", "are 3 apprentices" }, - { "changes_for_review", $"* 2 apprentices with changes for review" }, - { "requested_changes", $"* 1 apprentice with requested changes" }, - { "ilrchanges_to_confirm", "" }, + { "total_count_text", "You have 4 items that need your attention" }, + { "changes_for_review", "* 2 learners with changes for review" }, + { "requested_changes", "* 1 learner request to review" }, + { "ilrchanges_to_confirm", "* 1 learner with changes from ILR to confirm" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1007/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1007" } } @@ -521,7 +396,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 0 } }, AccountResponses = new List @@ -542,9 +417,9 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1006", Tokens = new Dictionary { - { "total_count_text", "are 2 apprentices" }, + { "total_count_text", "You have 2 items that need your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 2 apprentices with requested changes" }, + { "requested_changes", "* 2 learner requests to review" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1006" } @@ -563,15 +438,15 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1001", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1001", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1003", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1003", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1005", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1005", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 0 } }, AccountResponses = new List @@ -604,8 +479,8 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1001", Tokens = new Dictionary { - { "total_count_text", "are 2 apprentices" }, - { "changes_for_review", $"* 2 apprentices with changes for review" }, + { "total_count_text", "You have 2 items that need your attention" }, + { "changes_for_review", $"* 2 learners with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, @@ -618,8 +493,8 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1003", Tokens = new Dictionary { - { "total_count_text", "are 2 apprentices" }, - { "changes_for_review", $"* 2 apprentices with changes for review" }, + { "total_count_text", "You have 2 items that need your attention" }, + { "changes_for_review", "* 2 learners with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, @@ -632,12 +507,12 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1005", Tokens = new Dictionary { - { "total_count_text", "are 2 apprentices" }, + { "total_count_text", "You have 2 items that need your attention" }, { "changes_for_review", "" }, - { "requested_changes", $"* 2 apprentices with requested changes" }, + { "requested_changes", "* 2 learner requests to review" }, { "ilrchanges_to_confirm", "" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, - { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1005" } + { "link_to_unsubscribe", "/settings/notifications/unsubscribe/HSH1005" } } } } @@ -653,7 +528,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1001", TotalCount = 6, ChangesForReviewCount = 4, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1001", TotalCount = 7, ChangesForReviewCount = 4, RestartRequestCount = 2, PendingIlrChangesCount = 1 } }, AccountResponses = new List @@ -674,10 +549,10 @@ public IEnumerator GetEnumerator() HashedAccountId = "HSH1001", Tokens = new Dictionary { - { "total_count_text", $"are 6 apprentices" }, - { "changes_for_review", $"* 4 apprentices with changes for review" }, - { "requested_changes", $"* 2 apprentices with requested changes" }, - { "ilrchanges_to_confirm", "" }, + { "total_count_text", $"You have 7 items that need your attention" }, + { "changes_for_review", $"* 4 learners with changes for review" }, + { "requested_changes", $"* 2 learner requests to review" }, + { "ilrchanges_to_confirm", "* 1 learner with changes from ILR to confirm" }, //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } @@ -718,7 +593,8 @@ public EmployerAlertSummaryEmailServiceTestsFixture() _approvalsOuterApiClient = new Mock(); commitmentsV2Configuration = new CommitmentsV2Configuration() { - EmployerCommitmentsBaseUrl = EmployerCommitmentsBaseUrl + EmployerCommitmentsBaseUrl = EmployerCommitmentsBaseUrl, + CoCApprovalsActive = true }; } diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs index f88277910..82050cab9 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs @@ -68,7 +68,7 @@ private async Task SendEmail(EmployerAlertSummaryNotification alertSummary, long { "changes_for_review", ChangesForReviewText(alertSummary.ChangesForReviewCount) }, { "requested_changes", RestartRequestText(alertSummary.RestartRequestCount) }, { "ilrchanges_to_confirm", IlrChangesToConfirmText(alertSummary.PendingIlrChangesCount) }, - { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, + //{ "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/{hashedAccountId}" } }; From 51f431434fb0f5d314a919bdb7b77d9abb80c22d Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Thu, 18 Jun 2026 16:29:09 +0100 Subject: [PATCH 4/6] finished off tests --- .../EmployerAlertSummaryEmailServiceTests.cs | 34 ++++++++++--------- .../EmployerAlertSummaryEmailService.cs | 2 +- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs index 5125ce4dc..fb08ffbd1 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/EmployerAlertSummaryEmailServiceTests.cs @@ -108,7 +108,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", $"* 1 learner with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -116,6 +116,7 @@ public IEnumerator GetEnumerator() }; #endregion + #region single course triage notification yield return new object[] { @@ -150,7 +151,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -192,7 +193,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "* 1 learner with changes from ILR to confirm" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1000/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1000" } } } @@ -200,7 +201,7 @@ public IEnumerator GetEnumerator() }; #endregion - + #region multiple notifications yield return new object[] { @@ -295,7 +296,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", $"* 1 learner with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } }, @@ -309,7 +310,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", $"* 1 learner with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1002/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1002" } } }, @@ -323,7 +324,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "* 2 learners with changes from ILR to confirm" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1003" } } }, @@ -337,7 +338,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1004/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1004" } } }, @@ -351,7 +352,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", $"* 1 learner request to review" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1005" } } }, @@ -365,7 +366,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", $"* 2 learner requests to review" }, { "ilrchanges_to_confirm", "* 2 learners with changes from ILR to confirm" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1006" } } }, @@ -379,7 +380,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "* 2 learners with changes for review" }, { "requested_changes", "* 1 learner request to review" }, { "ilrchanges_to_confirm", "* 1 learner with changes from ILR to confirm" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1007/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1007" } } } @@ -421,7 +422,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", "* 2 learner requests to review" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1006/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1006" } } } @@ -483,7 +484,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", $"* 2 learners with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } }, @@ -497,7 +498,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "* 2 learners with changes for review" }, { "requested_changes", "" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1003/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1003" } } }, @@ -511,7 +512,7 @@ public IEnumerator GetEnumerator() { "changes_for_review", "" }, { "requested_changes", "* 2 learner requests to review" }, { "ilrchanges_to_confirm", "" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1005/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", "/settings/notifications/unsubscribe/HSH1005" } } } @@ -553,13 +554,14 @@ public IEnumerator GetEnumerator() { "changes_for_review", $"* 4 learners with changes for review" }, { "requested_changes", $"* 2 learner requests to review" }, { "ilrchanges_to_confirm", "* 1 learner with changes from ILR to confirm" }, - //{ "link_to_mange_apprenticeships", $"{EmployerCommitmentsBaseUrl}/HSH1001/apprentices" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/HSH1001" } } } } }; #endregion + } #region Test Data Classes diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs index 82050cab9..f88277910 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2/Services/EmployerAlertSummaryEmailService.cs @@ -68,7 +68,7 @@ private async Task SendEmail(EmployerAlertSummaryNotification alertSummary, long { "changes_for_review", ChangesForReviewText(alertSummary.ChangesForReviewCount) }, { "requested_changes", RestartRequestText(alertSummary.RestartRequestCount) }, { "ilrchanges_to_confirm", IlrChangesToConfirmText(alertSummary.PendingIlrChangesCount) }, - //{ "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, + { "link_to_mange_apprenticeships", $"Sign into your Apprenticeship Service Account" }, { "link_to_unsubscribe", $"/settings/notifications/unsubscribe/{hashedAccountId}" } }; From 0064029056f8efabdd1634d01d70050177987c5f Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Fri, 19 Jun 2026 11:30:40 +0100 Subject: [PATCH 5/6] finished tests for DB --- .../ApprenticeshipDomainServiceTests.cs | 83 ++++++++++++------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs index 0022d96dd..1529ea6c3 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs @@ -6,6 +6,7 @@ using SFA.DAS.Encoding; using SFA.DAS.Testing.Builders; using System.Collections; +using static SFA.DAS.CommitmentsV2.UnitTests.Services.ApprenticeshipDomainServiceTests.DataCases; namespace SFA.DAS.CommitmentsV2.UnitTests.Services { @@ -29,7 +30,8 @@ public async Task ThenCorrectNumberOfEmployerNotifcationReturned(List i .WithApprenticeship(input.ApprenticeshipInput.AccountLegalEntityId, input.ApprenticeshipInput.LegalEntityId, input.ApprenticeshipInput.AccountId, input.ApprenticeshipInput.CohortId, input.ApprenticeshipInput.ApprenticeshipId, input.ApprenticeshipInput.PaymentStatus, input.ApprenticeshipInput.Originator) .WithDataLock(input.DataLockInput.DataLockStatusId, input.ApprenticeshipInput.ApprenticeshipId, input.DataLockInput.IsResolved, input.DataLockInput.IsExpired, input.DataLockInput.Status, - input.DataLockInput.EventStatus, input.DataLockInput.TriageStatus, input.DataLockInput.ErrorCode); + input.DataLockInput.EventStatus, input.DataLockInput.TriageStatus, input.DataLockInput.ErrorCode) + .WithApprovalRequest(input.ApprenticeshipInput.ApprenticeshipId, input.ApprovalResultStatus); } // Act @@ -80,7 +83,7 @@ public IEnumerator GetEnumerator() }; #endregion - #region single provider notification + #region single provider notification and Pending ILR Approval notification yield return new object[] { new List @@ -88,20 +91,21 @@ public IEnumerator GetEnumerator() new Input { ApprenticeshipInput = new ApprenticeshipInput { AccountLegalEntityId = 0, LegalEntityId = "LE0", AccountId = 1000, CohortId = 0, ApprenticeshipId = 1, PaymentStatus = PaymentStatus.Active, Originator = Originator.Provider }, - DataLockInput = new DataLockInput { DataLockStatusId = 0, IsResolved = true, IsExpired = true, Status = Status.Pass, EventStatus = EventStatus.Removed, TriageStatus = TriageStatus.Unknown, ErrorCode = DataLockErrorCode.None } - }, + DataLockInput = new DataLockInput { DataLockStatusId = 0, IsResolved = true, IsExpired = true, Status = Status.Pass, EventStatus = EventStatus.Removed, TriageStatus = TriageStatus.Unknown, ErrorCode = DataLockErrorCode.None }, + ApprovalResultStatus = CocApprovalResultStatus.Pending + } }, new List { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1000", TotalCount = 2, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 1 } } }; #endregion - #region single price triage notification + #region single price triage notification and no notification for ILR as it's been completed yield return new object[] { new List @@ -109,14 +113,15 @@ public IEnumerator GetEnumerator() new Input { ApprenticeshipInput = new ApprenticeshipInput { AccountLegalEntityId = 0, LegalEntityId = "LE0", AccountId = 1000, CohortId = 0, ApprenticeshipId = 2, PaymentStatus = PaymentStatus.Active, Originator = Originator.Employer }, - DataLockInput = new DataLockInput { DataLockStatusId = 0, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Change, ErrorCode = DataLockErrorCode.Dlock07 } + DataLockInput = new DataLockInput { DataLockStatusId = 0, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Change, ErrorCode = DataLockErrorCode.Dlock07 }, + ApprovalResultStatus = CocApprovalResultStatus.Complete } }, new List { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0 } } }; @@ -137,7 +142,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 } } }; @@ -158,7 +163,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 } } }; @@ -179,7 +184,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 } } }; @@ -200,7 +205,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 } } }; @@ -258,27 +263,27 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1001", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1001", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1002", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1002", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1003", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1003", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1004", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1004", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1005", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1 + EmployerHashedAccountId = "HSH1005", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 0 } } }; @@ -306,7 +311,7 @@ public IEnumerator GetEnumerator() { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 0 } } }; @@ -352,22 +357,23 @@ public IEnumerator GetEnumerator() new Input { ApprenticeshipInput = new ApprenticeshipInput { AccountLegalEntityId = 5, LegalEntityId = "LE5", AccountId = 1005, CohortId = 5, ApprenticeshipId = 6, PaymentStatus = PaymentStatus.Active, Originator = Originator.Employer }, - DataLockInput = new DataLockInput { DataLockStatusId = 6, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Restart, ErrorCode = DataLockErrorCode.Dlock06 } + DataLockInput = new DataLockInput { DataLockStatusId = 6, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Restart, ErrorCode = DataLockErrorCode.Dlock06 }, + ApprovalResultStatus = CocApprovalResultStatus.Pending } }, new List { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1001", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1001", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1003", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0 + EmployerHashedAccountId = "HSH1003", TotalCount = 2, ChangesForReviewCount = 2, RestartRequestCount = 0, PendingIlrChangesCount = 0 }, new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1005", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1005", TotalCount = 3, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 1 } } }; @@ -401,26 +407,29 @@ public IEnumerator GetEnumerator() new Input { ApprenticeshipInput = new ApprenticeshipInput { AccountLegalEntityId = 1, LegalEntityId = "LE1", AccountId = 1001, CohortId = 1, ApprenticeshipId = 4, PaymentStatus = PaymentStatus.Active, Originator = Originator.Employer }, - DataLockInput = new DataLockInput { DataLockStatusId = 4, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Change, ErrorCode = DataLockErrorCode.Dlock07 } + DataLockInput = new DataLockInput { DataLockStatusId = 4, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Change, ErrorCode = DataLockErrorCode.Dlock07 }, + ApprovalResultStatus = CocApprovalResultStatus.Pending }, // single course triage notification new Input { ApprenticeshipInput = new ApprenticeshipInput { AccountLegalEntityId = 1, LegalEntityId = "LE1", AccountId = 1001, CohortId = 1, ApprenticeshipId = 5, PaymentStatus = PaymentStatus.Active, Originator = Originator.Employer }, - DataLockInput = new DataLockInput { DataLockStatusId = 5, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Restart, ErrorCode = DataLockErrorCode.Dlock06 } + DataLockInput = new DataLockInput { DataLockStatusId = 5, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Restart, ErrorCode = DataLockErrorCode.Dlock06 }, + ApprovalResultStatus = CocApprovalResultStatus.Pending }, // single course triage notification new Input { ApprenticeshipInput = new ApprenticeshipInput { AccountLegalEntityId = 1, LegalEntityId = "LE1", AccountId = 1001, CohortId = 1, ApprenticeshipId = 6, PaymentStatus = PaymentStatus.Active, Originator = Originator.Employer }, - DataLockInput = new DataLockInput { DataLockStatusId = 6, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Restart, ErrorCode = DataLockErrorCode.Dlock06 } + DataLockInput = new DataLockInput { DataLockStatusId = 6, IsResolved = false, IsExpired = false, Status = Status.Fail, EventStatus = EventStatus.New, TriageStatus = TriageStatus.Restart, ErrorCode = DataLockErrorCode.Dlock06 }, + ApprovalResultStatus = CocApprovalResultStatus.Pending } }, new List { new EmployerAlertSummaryNotification { - EmployerHashedAccountId = "HSH1001", TotalCount = 6, ChangesForReviewCount = 4, RestartRequestCount = 2 + EmployerHashedAccountId = "HSH1001", TotalCount = 9, ChangesForReviewCount = 4, RestartRequestCount = 2, PendingIlrChangesCount = 3 } } }; @@ -432,6 +441,7 @@ public class Input { public ApprenticeshipInput ApprenticeshipInput { get; set; } public DataLockInput DataLockInput { get; set; } + public CocApprovalResultStatus? ApprovalResultStatus { get; set; } } public class ApprenticeshipInput @@ -462,6 +472,7 @@ public class ApprenticeshipDomainServiceTestsFixture { public List SeedApprenticeships { get; } public List SeedDataLocks { get; } + public List SeedApprovalRequests { get; } private Mock _encodingService; @@ -469,6 +480,7 @@ public ApprenticeshipDomainServiceTestsFixture() { SeedApprenticeships = new List(); SeedDataLocks = new List(); + SeedApprovalRequests = new List(); _encodingService = new Mock(); _encodingService.Setup(s => s.Encode(It.IsAny(), EncodingType.AccountId)).Returns((value, encodingType) => $"HSH{value}"); @@ -504,6 +516,7 @@ private void SeedData(ProviderCommitmentsDbContext dbContext) { dbContext.Apprenticeships.AddRange(SeedApprenticeships); dbContext.DataLocks.AddRange(SeedDataLocks); + dbContext.ApprovalRequests.AddRange(SeedApprovalRequests); dbContext.SaveChanges(true); } @@ -556,6 +569,20 @@ public ApprenticeshipDomainServiceTestsFixture WithDataLock(long dataLockStatusI SeedDataLocks.Add(dataLock); return this; } + + public ApprenticeshipDomainServiceTestsFixture WithApprovalRequest(long apprenticeshipId, CocApprovalResultStatus? status) + { + if (status != null) + { + var approval = new ApprovalRequest() + .Set(c => c.Id, Guid.NewGuid()) + .Set(c => c.ApprenticeshipId, apprenticeshipId) + .Set(c => c.Status, status); + + SeedApprovalRequests.Add(approval); + } + return this; + } } } } From 10d87fa50cb3da9e34a482e47a5abd6d13dca5ad Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Fri, 19 Jun 2026 11:31:17 +0100 Subject: [PATCH 6/6] removed unused iusing --- .../Services/ApprenticeshipDomainServiceTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs index 1529ea6c3..1c5fe50bd 100644 --- a/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs +++ b/src/CommitmentsV2/SFA.DAS.CommitmentsV2.UnitTests/Services/ApprenticeshipDomainServiceTests.cs @@ -6,7 +6,6 @@ using SFA.DAS.Encoding; using SFA.DAS.Testing.Builders; using System.Collections; -using static SFA.DAS.CommitmentsV2.UnitTests.Services.ApprenticeshipDomainServiceTests.DataCases; namespace SFA.DAS.CommitmentsV2.UnitTests.Services {