-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Con 2567 create cohort request cop (#149)
* CON-2567-Added Api call to create cohort request for Cop * CON-2567-package updated * con-2567-updated package * CON-2567 Added Unit Test
- Loading branch information
1 parent
9414552
commit 9099e89
Showing
7 changed files
with
120 additions
and
14 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
57 changes: 57 additions & 0 deletions
57
...erCommitmentsV2.Web.UnitTests/Mappers/Apprentice/CreateChangeOfPartyRequestMapperTests.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,57 @@ | ||
using AutoFixture; | ||
using NUnit.Framework; | ||
using SFA.DAS.CommitmentsV2.Api.Types.Requests; | ||
using SFA.DAS.CommitmentsV2.Types; | ||
using SFA.DAS.EmployerCommitmentsV2.Web.Mappers.Apprentice; | ||
using SFA.DAS.EmployerCommitmentsV2.Web.Models.Apprentice; | ||
using System.Threading.Tasks; | ||
|
||
namespace SFA.DAS.EmployerCommitmentsV2.Web.UnitTests.Mappers.Apprentice | ||
{ | ||
[TestFixture] | ||
public class CreateChangeOfPartyRequestMapperTests | ||
{ | ||
private CreateChangeOfPartyRequestMapper _mapper; | ||
private SendNewTrainingProviderViewModel _source; | ||
private CreateChangeOfPartyRequestRequest _result; | ||
|
||
[SetUp] | ||
public async Task Arrange() | ||
{ | ||
//Arrange | ||
var fixture = new Fixture(); | ||
_source = new SendNewTrainingProviderViewModel | ||
{ | ||
ProviderId = fixture.Create<long>(), | ||
AccountHashedId = fixture.Create<string>(), | ||
AccountId = fixture.Create<long>(), | ||
Confirm = fixture.Create<bool>(), | ||
OldProviderName = fixture.Create<string>(), | ||
NewProviderName = fixture.Create<string>(), | ||
EmployerName = fixture.Create<string>(), | ||
ApprenticeName = fixture.Create<string>(), | ||
ApprenticeshipStatus = ApprenticeshipStatus.Stopped, | ||
ApprenticeshipId = fixture.Create<int>(), | ||
ApprenticeshipHashedId = fixture.Create<string>() | ||
}; | ||
_mapper = new CreateChangeOfPartyRequestMapper(); | ||
|
||
//Act | ||
_result = await _mapper.Map(TestHelper.Clone(_source)); | ||
} | ||
|
||
[Test] | ||
public void ChangeOfPartyRequestTypeIsMappedCorrectly() | ||
{ | ||
//Assert | ||
Assert.AreEqual(ChangeOfPartyRequestType.ChangeProvider, _result.ChangeOfPartyRequestType); | ||
} | ||
|
||
[Test] | ||
public void NewPartyIdIsMappedCorrectly() | ||
{ | ||
//Assert | ||
Assert.AreEqual(_source.ProviderId, _result.NewPartyId); | ||
} | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/SFA.DAS.EmployerCommitmentsV2.Web/Mappers/Apprentice/CreateChangeOfPartyRequestMapper.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,20 @@ | ||
using SFA.DAS.CommitmentsV2.Api.Types.Requests; | ||
using SFA.DAS.CommitmentsV2.Shared.Interfaces; | ||
using SFA.DAS.CommitmentsV2.Types; | ||
using SFA.DAS.EmployerCommitmentsV2.Web.Models.Apprentice; | ||
using System.Threading.Tasks; | ||
|
||
namespace SFA.DAS.EmployerCommitmentsV2.Web.Mappers.Apprentice | ||
{ | ||
public class CreateChangeOfPartyRequestMapper : IMapper<SendNewTrainingProviderViewModel, CreateChangeOfPartyRequestRequest> | ||
{ | ||
public Task<CreateChangeOfPartyRequestRequest> Map(SendNewTrainingProviderViewModel source) | ||
{ | ||
return Task.FromResult(new CreateChangeOfPartyRequestRequest | ||
{ | ||
ChangeOfPartyRequestType = ChangeOfPartyRequestType.ChangeProvider, | ||
NewPartyId = source.ProviderId | ||
}); | ||
} | ||
} | ||
} |
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