-
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.
Merge pull request #159 from SkillsFundingAgency/CON-2598-Enable-empl…
…oyer-to-choose-who-enters-price-and-dates CON-2598 Add who will enter details page
- Loading branch information
Showing
30 changed files
with
605 additions
and
64 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
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
76 changes: 76 additions & 0 deletions
76
...tTests/Controllers/ApprenticeControllerTests/WhenCallingGetWhoWillEnterTheDetailsTests.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,76 @@ | ||
using AutoFixture; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
using Moq; | ||
using NUnit.Framework; | ||
using SFA.DAS.Authorization.Services; | ||
using SFA.DAS.CommitmentsV2.Api.Client; | ||
using SFA.DAS.CommitmentsV2.Shared.Interfaces; | ||
using SFA.DAS.EmployerCommitmentsV2.Web.Controllers; | ||
using SFA.DAS.EmployerCommitmentsV2.Web.Models.Apprentice; | ||
using SFA.DAS.EmployerUrlHelper; | ||
using System.Threading.Tasks; | ||
|
||
namespace SFA.DAS.EmployerCommitmentsV2.Web.UnitTests.Controllers.ApprenticeControllerTests | ||
{ | ||
public class WhenCallingGetWhoWillEnterTheDetailsTests | ||
{ | ||
WhenCallingGetWhoWillEnterTheDetailsTestsFixture _fixture; | ||
|
||
[SetUp] | ||
public void Arrange() | ||
{ | ||
_fixture = new WhenCallingGetWhoWillEnterTheDetailsTestsFixture(); | ||
} | ||
|
||
[Test] | ||
public async Task ThenTheCorrectViewIsReturned() | ||
{ | ||
var result = await _fixture.WhoWillEnterTheDetails(); | ||
|
||
_fixture.VerifyViewModel(result as ViewResult); | ||
} | ||
} | ||
|
||
public class WhenCallingGetWhoWillEnterTheDetailsTestsFixture | ||
{ | ||
private readonly WhoWillEnterTheDetailsRequest _request; | ||
private readonly WhoWillEnterTheDetailsViewModel _viewModel; | ||
|
||
private readonly Mock<IModelMapper> _mockMapper; | ||
|
||
private readonly ApprenticeController _controller; | ||
|
||
public WhenCallingGetWhoWillEnterTheDetailsTestsFixture() | ||
{ | ||
var autoFixture = new Fixture(); | ||
|
||
_request = autoFixture.Create<WhoWillEnterTheDetailsRequest>(); | ||
_viewModel = autoFixture.Create<WhoWillEnterTheDetailsViewModel>(); | ||
|
||
_mockMapper = new Mock<IModelMapper>(); | ||
_mockMapper.Setup(m => m.Map<WhoWillEnterTheDetailsViewModel>(_request)) | ||
.ReturnsAsync(_viewModel); | ||
|
||
_controller = new ApprenticeController(_mockMapper.Object, | ||
Mock.Of<ICookieStorageService<IndexRequest>>(), | ||
Mock.Of<ICommitmentsApiClient>(), | ||
Mock.Of<ILinkGenerator>(), | ||
Mock.Of<ILogger<ApprenticeController>>(), | ||
Mock.Of<IAuthorizationService>()); | ||
} | ||
|
||
public async Task<IActionResult> WhoWillEnterTheDetails() | ||
{ | ||
return await _controller.WhoWillEnterTheDetails(_request); | ||
} | ||
|
||
public void VerifyViewModel(ViewResult viewResult) | ||
{ | ||
var viewModel = viewResult.Model as WhoWillEnterTheDetailsViewModel; | ||
|
||
Assert.IsInstanceOf<WhoWillEnterTheDetailsViewModel>(viewModel); | ||
Assert.AreEqual(_viewModel, viewModel); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.