Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public async Task ThenCorrectNumberOfEmployerNotifcationReturned(List<DataCases.
.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
Expand All @@ -49,7 +50,8 @@ public async Task ThenCorrectEmployerNotifcationReturned(List<DataCases.Input> 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
Expand Down Expand Up @@ -80,43 +82,45 @@ public IEnumerator GetEnumerator()
};
#endregion

#region single provider notification
#region single provider notification and Pending ILR Approval notification
yield return new object[]
{
new List<Input>
{
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<EmployerAlertSummaryNotification>
{
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<Input>
{
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<EmployerAlertSummaryNotification>
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 1, RestartRequestCount = 0, PendingIlrChangesCount = 0
}
}
};
Expand All @@ -137,7 +141,7 @@ public IEnumerator GetEnumerator()
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0
}
}
};
Expand All @@ -158,7 +162,7 @@ public IEnumerator GetEnumerator()
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0
}
}
};
Expand All @@ -179,7 +183,7 @@ public IEnumerator GetEnumerator()
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0
}
}
};
Expand All @@ -200,7 +204,7 @@ public IEnumerator GetEnumerator()
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1
EmployerHashedAccountId = "HSH1000", TotalCount = 1, ChangesForReviewCount = 0, RestartRequestCount = 1, PendingIlrChangesCount = 0
}
}
};
Expand Down Expand Up @@ -258,27 +262,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
}
}
};
Expand Down Expand Up @@ -306,7 +310,7 @@ public IEnumerator GetEnumerator()
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2
EmployerHashedAccountId = "HSH1006", TotalCount = 2, ChangesForReviewCount = 0, RestartRequestCount = 2, PendingIlrChangesCount = 0
}
}
};
Expand Down Expand Up @@ -352,22 +356,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<EmployerAlertSummaryNotification>
{
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
}
}
};
Expand Down Expand Up @@ -401,26 +406,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<EmployerAlertSummaryNotification>
{
new EmployerAlertSummaryNotification
{
EmployerHashedAccountId = "HSH1001", TotalCount = 6, ChangesForReviewCount = 4, RestartRequestCount = 2
EmployerHashedAccountId = "HSH1001", TotalCount = 9, ChangesForReviewCount = 4, RestartRequestCount = 2, PendingIlrChangesCount = 3
}
}
};
Expand All @@ -432,6 +440,7 @@ public class Input
{
public ApprenticeshipInput ApprenticeshipInput { get; set; }
public DataLockInput DataLockInput { get; set; }
public CocApprovalResultStatus? ApprovalResultStatus { get; set; }
}

public class ApprenticeshipInput
Expand Down Expand Up @@ -462,13 +471,15 @@ public class ApprenticeshipDomainServiceTestsFixture
{
public List<Apprenticeship> SeedApprenticeships { get; }
public List<DataLockStatus> SeedDataLocks { get; }
public List<ApprovalRequest> SeedApprovalRequests { get; }

private Mock<IEncodingService> _encodingService;

public ApprenticeshipDomainServiceTestsFixture()
{
SeedApprenticeships = new List<Apprenticeship>();
SeedDataLocks = new List<DataLockStatus>();
SeedApprovalRequests = new List<ApprovalRequest>();

_encodingService = new Mock<IEncodingService>();
_encodingService.Setup(s => s.Encode(It.IsAny<long>(), EncodingType.AccountId)).Returns<long, EncodingType>((value, encodingType) => $"HSH{value}");
Expand Down Expand Up @@ -503,6 +514,7 @@ private void SeedData(ProviderCommitmentsDbContext dbContext)
{
dbContext.Apprenticeships.AddRange(SeedApprenticeships);
dbContext.DataLocks.AddRange(SeedDataLocks);
dbContext.ApprovalRequests.AddRange(SeedApprovalRequests);
dbContext.SaveChanges(true);
}

Expand Down Expand Up @@ -555,6 +567,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;
}
}
}
}
Loading
Loading