-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #721 from SkillsFundingAgency/MF-509-Hide_ILR_Mism…
…atch_For_Employers MF-509 hide ilr mismatch for employers
- Loading branch information
Showing
8 changed files
with
207 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 164 additions & 0 deletions
164
...eryableApprenticeshipsExtensions/WhenGettingEmployerApprenticeshipsWithOrWithoutAlerts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using SFA.DAS.CommitmentsV2.Application.Queries.GetApprenticeships.Search.Services.Parameters; | ||
using SFA.DAS.CommitmentsV2.Domain.Interfaces; | ||
using SFA.DAS.CommitmentsV2.Extensions; | ||
using SFA.DAS.CommitmentsV2.Models; | ||
using SFA.DAS.CommitmentsV2.Types; | ||
|
||
namespace SFA.DAS.CommitmentsV2.UnitTests.Extensions.QueryableApprenticeshipsExtensions | ||
{ | ||
public class WhenGettingEmployerApprenticeshipsWithOrWithoutAlerts | ||
{ | ||
private IQueryable<Apprenticeship> _apprenticeships; | ||
private readonly ApprenticeshipSearchParameters _parameters = new ApprenticeshipSearchParameters { EmployerAccountId = 1 }; | ||
|
||
[SetUp] | ||
public void Arrange() | ||
{ | ||
_apprenticeships = GetTestData(); | ||
} | ||
|
||
[Test] | ||
public void ThenWillReturnApprenticeshipsWithAlerts() | ||
{ | ||
//Act | ||
var result = _apprenticeships.WithAlerts(true, _parameters).ToList(); | ||
|
||
//Assert | ||
Assert.AreEqual(2, result.Count); | ||
Assert.AreEqual(1, result[0].Id); | ||
Assert.AreEqual(3, result[1].Id); | ||
} | ||
|
||
[Test] | ||
public void ThenWillReturnApprenticeshipsWithoutAlerts() | ||
{ | ||
//Act | ||
var result = _apprenticeships.WithAlerts(false, _parameters).ToList(); | ||
|
||
//Assert | ||
Assert.AreEqual(6, result.Count); | ||
|
||
Assert.AreEqual(2, result[0].Id); | ||
Assert.AreEqual(4, result[1].Id); | ||
Assert.AreEqual(5, result[2].Id); | ||
Assert.AreEqual(6, result[3].Id); | ||
Assert.AreEqual(7, result[4].Id); | ||
Assert.AreEqual(9, result[5].Id); | ||
} | ||
|
||
private static IQueryable<Apprenticeship> GetTestData() | ||
{ | ||
var apprenticeships = new List<Apprenticeship> | ||
{ | ||
new Apprenticeship | ||
{ | ||
Id = 1, | ||
DataLockStatus = new List<DataLockStatus> | ||
{ | ||
new DataLockStatus | ||
{ | ||
IsResolved = false, | ||
Status = Status.Fail, | ||
EventStatus = EventStatus.New, | ||
TriageStatus = TriageStatus.Change | ||
} | ||
} | ||
}, | ||
new Apprenticeship {Id = 2}, | ||
new Apprenticeship | ||
{ | ||
Id = 3, | ||
ApprenticeshipUpdate = new List<ApprenticeshipUpdate> | ||
{ | ||
new ApprenticeshipUpdate | ||
{ | ||
Status = ApprenticeshipUpdateStatus.Pending, | ||
Originator = Originator.Provider | ||
} | ||
} | ||
}, | ||
new Apprenticeship | ||
{ | ||
Id = 4, | ||
DataLockStatus = new List<DataLockStatus> | ||
{ | ||
new DataLockStatus | ||
{ | ||
IsResolved = true, | ||
Status = Status.Fail, | ||
EventStatus = EventStatus.New | ||
} | ||
} | ||
}, | ||
new Apprenticeship | ||
{ | ||
Id = 5, | ||
DataLockStatus = new List<DataLockStatus> | ||
{ | ||
new DataLockStatus | ||
{ | ||
IsResolved = false, | ||
Status = Status.Pass, | ||
EventStatus = EventStatus.New | ||
} | ||
} | ||
}, | ||
new Apprenticeship | ||
{ | ||
Id = 6, | ||
DataLockStatus = new List<DataLockStatus> | ||
{ | ||
new DataLockStatus | ||
{ | ||
IsResolved = false, | ||
Status = Status.Fail, | ||
EventStatus = EventStatus.Removed | ||
} | ||
} | ||
}, | ||
new Apprenticeship | ||
{ | ||
Id = 7, | ||
ApprenticeshipUpdate = new List<ApprenticeshipUpdate> | ||
{ | ||
new ApprenticeshipUpdate | ||
{ | ||
Status = ApprenticeshipUpdateStatus.Deleted, | ||
Originator = Originator.Provider | ||
} | ||
} | ||
}, | ||
new Apprenticeship | ||
{ | ||
Id = 8, | ||
ApprenticeshipUpdate = new List<ApprenticeshipUpdate> | ||
{ | ||
new ApprenticeshipUpdate | ||
{ | ||
Status = ApprenticeshipUpdateStatus.Pending, | ||
Originator = Originator.Unknown | ||
} | ||
} | ||
}, | ||
new Apprenticeship | ||
{ | ||
Id = 9, | ||
DataLockStatus = new List<DataLockStatus> | ||
{ | ||
new DataLockStatus | ||
{ | ||
ErrorCode = DataLockErrorCode.Dlock03, | ||
TriageStatus = TriageStatus.Unknown, | ||
IsResolved = false | ||
|
||
} | ||
} | ||
} | ||
}.AsQueryable(); | ||
return apprenticeships; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters