-
Notifications
You must be signed in to change notification settings - Fork 8
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 #2021 from SkillsFundingAgency/CON-1403-Add-Appren…
…tice-Journey-Provider-Actions Con 1403 add apprentice journey provider actions
- Loading branch information
Showing
63 changed files
with
2,145 additions
and
166 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Root Type="DevExpress.CodeRush.Foundation.Navigation.QuickFileNav.SolutionFileInfosContainer"> | ||
<Options Language="Neutral"> | ||
<Items> | ||
<Item Id="{8a02d3a3-2b65-4c3b-b255-20e60303a11e}"> | ||
<Filename>EmployerTeamController.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath> | ||
<Folders> | ||
<Item>Controllers</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{94894b8d-c8da-4361-a132-fbf3ed6eae94}"> | ||
<Filename>EmployerTeamController.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath> | ||
<Folders> | ||
<Item>Controllers</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{d300401c-1b37-4cc1-8d68-e727c2ccba80}"> | ||
<Filename>UrlHelperExtensions.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\extensions\urlhelperextensions.cs</FilePath> | ||
<Folders> | ||
<Item>Extensions</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{6b7660f7-c583-4ef0-8f67-9faaa29e950c}"> | ||
<Filename>UrlHelperExtensions.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.eas.support.web\extensions\urlhelperextensions.cs</FilePath> | ||
<Folders> | ||
<Item>Extensions</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EAS.Support.Web\SFA.DAS.EAS.Support.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EAS.Support.Web</ProjectName> | ||
</Item> | ||
<Item Id="{92d9e756-5f0e-45a3-8820-7b3103628e2a}"> | ||
<Filename>EmployerTeamOrchestrator.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\orchestrators\employerteamorchestrator.cs</FilePath> | ||
<Folders> | ||
<Item>Orchestrators</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{36f1e025-c645-4f6a-95ac-8c2bb7e72efc}"> | ||
<Filename>EmployerTeamController.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath> | ||
<Folders> | ||
<Item>Controllers</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{c2e527d6-e2b9-4f3d-b526-160c267e3386}"> | ||
<Filename>EmployerTeam</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\views\employerteam\</FilePath> | ||
<Folders> | ||
<Item>Views</Item> | ||
</Folders> | ||
<LocationType>Folder</LocationType> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{892a4756-3f8f-4434-acef-51f7367a7bd8}"> | ||
<Filename>EmployerTeamController.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web\controllers\employerteamcontroller.cs</FilePath> | ||
<Folders> | ||
<Item>Controllers</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web\SFA.DAS.EmployerAccounts.Web.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web</ProjectName> | ||
</Item> | ||
<Item Id="{86a9c0a5-db6c-4a6e-8308-862537d621c5}"> | ||
<Filename>GetReservationsRequestHandler.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts\queries\getreservations\getreservationsrequesthandler.cs</FilePath> | ||
<Folders> | ||
<Item>Queries</Item> | ||
<Item>GetReservations</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts\SFA.DAS.EmployerAccounts.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts</ProjectName> | ||
</Item> | ||
<Item Id="{af3cefe5-28eb-4a50-8565-af435bf961de}"> | ||
<Filename>WhenGettingAccount.cs</Filename> | ||
<FilePath>c:\esfa\das-employerapprenticeshipsservice\src\sfa.das.employeraccounts.web.unittests\orchestrators\employerteamorchestratortests\whengettingaccount.cs</FilePath> | ||
<Folders> | ||
<Item>Orchestrators</Item> | ||
<Item>EmployerTeamOrchestratorTests</Item> | ||
</Folders> | ||
<ProjectFileName>C:\ESFA\das-employerapprenticeshipsservice\src\SFA.DAS.EmployerAccounts.Web.UnitTests\SFA.DAS.EmployerAccounts.Web.UnitTests.csproj</ProjectFileName> | ||
<ProjectName>SFA.DAS.EmployerAccounts.Web.UnitTests</ProjectName> | ||
</Item> | ||
</Items> | ||
</Options> | ||
</Root> |
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
78 changes: 78 additions & 0 deletions
78
src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetApprenticeship/WhenIGetApprenticeship.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,78 @@ | ||
using Moq; | ||
using SFA.DAS.EmployerAccounts.Interfaces; | ||
using SFA.DAS.EmployerAccounts.Queries.GetApprenticeship; | ||
using SFA.DAS.Validation; | ||
using System; | ||
using NUnit.Framework; | ||
using SFA.DAS.NLog.Logger; | ||
using System.Threading.Tasks; | ||
using SFA.DAS.CommitmentsV2.Api.Types.Responses; | ||
using System.Collections.Generic; | ||
using SFA.DAS.EmployerAccounts.Models.CommitmentsV2; | ||
using SFA.DAS.HashingService; | ||
|
||
namespace SFA.DAS.EmployerAccounts.UnitTests.Queries.GetApprenticeship | ||
{ | ||
public class WhenIGetApprenticeship : QueryBaseTest<GetApprenticeshipsHandler, GetApprenticeshipsRequest, EmployerAccounts.Queries.GetApprenticeship.GetApprenticeshipsResponse> | ||
{ | ||
public override GetApprenticeshipsRequest Query { get; set; } | ||
public override GetApprenticeshipsHandler RequestHandler { get; set; } | ||
public override Mock<IValidator<GetApprenticeshipsRequest>> RequestValidator { get; set; } | ||
|
||
private Mock<ICommitmentV2Service> _commitmentV2Service; | ||
private Mock<IHashingService> _hashingService; | ||
private Mock<ILog> _logger; | ||
private long _accountId; | ||
private string _hashedAccountId; | ||
|
||
[SetUp] | ||
public void Arrange() | ||
{ | ||
SetUp(); | ||
|
||
_accountId = 123; | ||
_hashedAccountId = "ABC123"; | ||
_logger = new Mock<ILog>(); | ||
|
||
_commitmentV2Service = new Mock<ICommitmentV2Service>(); | ||
_hashingService = new Mock<IHashingService>(); | ||
|
||
_commitmentV2Service.Setup(m => m.GetApprenticeships(_accountId)).ReturnsAsync(new List<Apprenticeship> { new Apprenticeship { Id = 3 } }); | ||
_hashingService = new Mock<IHashingService>(); | ||
_hashingService.Setup(x => x.DecodeValue(_hashedAccountId)).Returns(_accountId); | ||
|
||
RequestHandler = new GetApprenticeshipsHandler(RequestValidator.Object, _logger.Object, _commitmentV2Service.Object, _hashingService.Object); | ||
|
||
Query = new GetApprenticeshipsRequest | ||
{ | ||
HashedAccountId = _hashedAccountId | ||
}; | ||
} | ||
|
||
|
||
public override Task ThenIfTheMessageIsValidTheRepositoryIsCalled() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
[Test] | ||
public async Task ThenIfTheMessageIsValidTheServiceIsCalled() | ||
{ | ||
//Act | ||
await RequestHandler.Handle(Query); | ||
|
||
//Assert | ||
_commitmentV2Service.Verify(x => x.GetApprenticeships(_accountId), Times.Once); | ||
} | ||
|
||
[Test] | ||
public override async Task ThenIfTheMessageIsValidTheValueIsReturnedInTheResponse() | ||
{ | ||
//Act | ||
var response = await RequestHandler.Handle(Query); | ||
|
||
//Assert | ||
Assert.IsNotNull(response.Apprenticeships); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetApprenticeship/WhenIValidateTheRequest.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,47 @@ | ||
using NUnit.Framework; | ||
using SFA.DAS.EmployerAccounts.Queries.GetApprenticeship; | ||
|
||
namespace SFA.DAS.EmployerAccounts.UnitTests.Queries.GetApprenticeship | ||
{ | ||
public class WhenIValidateTheRequest | ||
{ | ||
private GetApprenticeshipsValidator _validator; | ||
|
||
[SetUp] | ||
public void Arrange() | ||
{ | ||
_validator = new GetApprenticeshipsValidator(); | ||
} | ||
|
||
|
||
[Test] | ||
public void ThenShouldReturnValidIfRequestIsValid() | ||
{ | ||
//Act | ||
var result = _validator.Validate(new GetApprenticeshipsRequest { HashedAccountId = "123ABC", ExternalUserId = "user123" }); | ||
|
||
//Assert | ||
Assert.IsTrue(result.IsValid()); | ||
} | ||
|
||
[Test] | ||
public void ThenShouldReturnInvalidIfNoAccountIdIsProvided() | ||
{ | ||
//Act | ||
var result = _validator.Validate(new GetApprenticeshipsRequest { ExternalUserId = "user123" }); | ||
|
||
//Assert | ||
Assert.IsFalse(result.IsValid()); | ||
} | ||
|
||
[Test] | ||
public void ThenShouldReturnInValidIfRequestIsNotValid() | ||
{ | ||
//Act | ||
var result = _validator.Validate(new GetApprenticeshipsRequest { }); | ||
|
||
//Assert | ||
Assert.IsFalse(result.IsValid()); | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetSingleCohort/WhenIGetSingleCohort.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,84 @@ | ||
using Moq; | ||
using NUnit.Framework; | ||
using SFA.DAS.EmployerAccounts.Interfaces; | ||
using SFA.DAS.EmployerAccounts.Models.CommitmentsV2; | ||
using SFA.DAS.EmployerAccounts.Queries.GetSingleCohort; | ||
using SFA.DAS.Encoding; | ||
using SFA.DAS.HashingService; | ||
using SFA.DAS.NLog.Logger; | ||
using SFA.DAS.Validation; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace SFA.DAS.EmployerAccounts.UnitTests.Queries.GetSingleCohort | ||
{ | ||
public class WhenIGetSingleCohort : QueryBaseTest<GetSingleCohortRequestHandler, GetSingleCohortRequest, GetSingleCohortResponse> | ||
{ | ||
public override GetSingleCohortRequest Query { get; set; } | ||
public override GetSingleCohortRequestHandler RequestHandler { get; set; } | ||
public override Mock<IValidator<GetSingleCohortRequest>> RequestValidator { get; set; } | ||
private Mock<ICommitmentV2Service> _commitmentV2Service; | ||
private Mock<IHashingService> _hashingService; | ||
private long _accountId; | ||
private long _cohortId; | ||
public string hashedAccountId; | ||
|
||
[SetUp] | ||
public void Arrange() | ||
{ | ||
SetUp(); | ||
|
||
_accountId = 123; | ||
_cohortId = 1; | ||
hashedAccountId = "Abc123"; | ||
|
||
_commitmentV2Service = new Mock<ICommitmentV2Service>(); | ||
_commitmentV2Service.Setup(m => m.GetCohorts(_accountId)) | ||
.ReturnsAsync(new List<Cohort>() { new Cohort { Id = _cohortId, NumberOfDraftApprentices = 1 }}); | ||
|
||
_commitmentV2Service.Setup(m => m.GetDraftApprenticeships(It.IsAny<Cohort>())) | ||
.ReturnsAsync(new List<Apprenticeship> { new Apprenticeship { CourseName = "CourseName" } }); | ||
|
||
_hashingService = new Mock<IHashingService>(); | ||
_hashingService.Setup(x => x.DecodeValue(hashedAccountId)).Returns(_accountId); | ||
|
||
RequestHandler = new GetSingleCohortRequestHandler(RequestValidator.Object, _commitmentV2Service.Object, _hashingService.Object); | ||
|
||
Query = new GetSingleCohortRequest | ||
{ | ||
HashedAccountId = hashedAccountId | ||
}; | ||
} | ||
|
||
|
||
[Test] | ||
public override async Task ThenIfTheMessageIsValidTheValueIsReturnedInTheResponse() | ||
{ | ||
//Act | ||
var response = await RequestHandler.Handle(Query); | ||
|
||
//Assert | ||
Assert.IsNotNull(response.Cohort); | ||
Assert.IsTrue(response.Cohort.NumberOfDraftApprentices.Equals(1)); | ||
Assert.IsTrue(response.Cohort?.Apprenticeships.Count().Equals(1)); | ||
} | ||
|
||
|
||
[Test] | ||
public async Task ThenIfTheMessageIsValidTheServiceIsCalled() | ||
{ | ||
//Act | ||
await RequestHandler.Handle(Query); | ||
|
||
//Assert | ||
_commitmentV2Service.Verify(x => x.GetCohorts(_accountId), Times.Once); | ||
} | ||
|
||
public override Task ThenIfTheMessageIsValidTheRepositoryIsCalled() | ||
{ | ||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/SFA.DAS.EmployerAccounts.UnitTests/Queries/GetSingleCohort/WhenIValidateTheRequest.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,36 @@ | ||
using NUnit.Framework; | ||
using SFA.DAS.EmployerAccounts.Queries.GetSingleCohort; | ||
|
||
namespace SFA.DAS.EmployerAccounts.UnitTests.Queries.GetSingleCohort | ||
{ | ||
public class WhenIValidateTheRequest | ||
{ | ||
private GetSingleCohortRequestValidator _validator; | ||
|
||
[SetUp] | ||
public void Arrange() | ||
{ | ||
_validator = new GetSingleCohortRequestValidator(); | ||
} | ||
|
||
[Test] | ||
public void ThenShouldReturnValidIfRequestIsValid() | ||
{ | ||
//Act | ||
var result = _validator.Validate(new GetSingleCohortRequest { HashedAccountId = "Abc123" }); | ||
|
||
//Assert | ||
Assert.IsTrue(result.IsValid()); | ||
} | ||
|
||
[Test] | ||
public void ThenShouldReturnInValidIfRequestIsNotValid() | ||
{ | ||
//Act | ||
var result = _validator.Validate(new GetSingleCohortRequest { HashedAccountId = string.Empty }); | ||
|
||
//Assert | ||
Assert.IsFalse(result.IsValid()); | ||
} | ||
} | ||
} |
Oops, something went wrong.