Skip to content

Commit

Permalink
Merge pull request #758 from SkillsFundingAgency/CON-2087-Api
Browse files Browse the repository at this point in the history
Con 2087 api
  • Loading branch information
Najamuddin-Muhammad authored Jul 29, 2020
2 parents 12aa1c3 + c6b7b13 commit d1c67fb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ public class Apprenticeship
public Guid? ReservationId { get; set; }
public DateTime? OriginalStartDate { get; set; }
public long? ContinuationOfId { get; set; }
public bool? MadeRedundant { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,23 @@ public async Task ThenAccountLegalEntityPublicHashedIdIsMapped(GetApprenticeship
Assert.AreEqual(accountLegalEntityPublicHashedId, result.Content.AccountLegalEntityPublicHashedId);
}

[Test, AutoData]
public async Task ThenMadeRedundantIsMapped(GetApprenticeshipResponse mediatorResponse)
{
_mockMediator.Setup(x => x.SendAsync(It.IsAny<GetApprenticeshipRequest>())).ReturnsAsync(mediatorResponse);

// for this unit test we want a controller where the employerOrchestrator contains a real ApprenticeshipMapper
_employerOrchestrator = new EmployerOrchestrator(_mockMediator.Object, Mock.Of<ICommitmentsLogger>(), new FacetMapper(Mock.Of<ICurrentDateTime>()), new ApprenticeshipFilterService(new FacetMapper(Mock.Of<ICurrentDateTime>())),
new ApprenticeshipMapper(), _commitmentMapper.Object, Mock.Of<ITransferRequestMapper>(), Mock.Of<IHashingService>());

_controller = new EmployerController(_employerOrchestrator, _apprenticeshipsOrchestrator);

var result = await _controller.GetApprenticeship(TestProviderId, TestApprenticeshipId) as OkNegotiatedContentResult<Apprenticeship.Apprenticeship>;

result.Content.Should().NotBeNull();
Assert.AreEqual(mediatorResponse.Data.MadeRedundant, result.Content.MadeRedundant);
}

[Test]
public async Task ThenTheMediatorIsCalledWithTheCommitmentIdApprenticeshipIdProviderId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public Apprenticeship MapFrom(Domain.Entities.Apprenticeship source, CallerType
HasHadDataLockSuccess = source.HasHadDataLockSuccess,
EndpointAssessorName = source.EndpointAssessorName,
ReservationId = source.ReservationId,
ContinuationOfId = source.ContinuationOfId
ContinuationOfId = source.ContinuationOfId,
MadeRedundant = source.MadeRedundant
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ SELECT
END AS 'ProviderCanApproveApprenticeship',
ao.Name AS 'EndpointAssessorName',
a.ReservationId,
a.OriginalStartDate
a.OriginalStartDate,
a.MadeRedundant
FROM
Apprenticeship a
INNER JOIN
Expand Down

0 comments on commit d1c67fb

Please sign in to comment.