-
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 branch 'master' of https://github.com/SkillsFundingAgency/das-e…
…mployerapprenticeshipsservice into TM-133-Hide_the_option_to_create_a_transfers_pledge_from_levy_receivers_and_non-levy_employers
- Loading branch information
Showing
38 changed files
with
948 additions
and
58 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
12 changes: 12 additions & 0 deletions
12
...ployer_Account.Database/Scripts/Manual/CON-3921-DataFixForTermAndConditionsAcceptedOn.sql
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,12 @@ | ||
-- Update TermsAndConditionsAcceptedOn for all users created afer 28th July 2021 | ||
Update U | ||
Set U.TermAndConditionsAcceptedOn = T.CreatedDate | ||
From [employer_account].[User] U | ||
Inner join ( | ||
Select UserId, CreatedDate from ( | ||
Select *, ROW_NUMBER() over (partition by M.UserId order by M.CreatedDate) As Rank2 | ||
from [employer_account].[Membership] M | ||
) Result | ||
Where Result.Rank2 = 1 | ||
and CreatedDate >= CONVERT(DATETIME,'28/07/2021',103) --dd/MM/yyyy | ||
) T on U.Id = T.UserId |
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
107 changes: 107 additions & 0 deletions
107
...loyerAccounts.Web.UnitTests/Controllers/HomeControllerTests/WhenIViewTermsAndCondition.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,107 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using System.Web.Mvc; | ||
using Moq; | ||
using NUnit.Framework; | ||
using SFA.DAS.EmployerAccounts.Configuration; | ||
using SFA.DAS.EmployerAccounts.Interfaces; | ||
using SFA.DAS.EmployerAccounts.Web.Controllers; | ||
using SFA.DAS.EmployerAccounts.Web.Orchestrators; | ||
using SFA.DAS.EmployerAccounts.Web.ViewModels; | ||
using SFA.DAS.EmployerUsers.WebClientComponents; | ||
using SFA.DAS.Authentication; | ||
using SFA.DAS.EmployerAccounts.Web.Models; | ||
using SFA.DAS.NLog.Logger; | ||
|
||
namespace SFA.DAS.EmployerAccounts.Web.UnitTests.Controllers.HomeControllerTests | ||
{ | ||
public class WhenIViewTermsAndCondition : ControllerTestBase | ||
{ | ||
private Mock<IAuthenticationService> _owinWrapper; | ||
private Mock<HomeOrchestrator> _homeOrchestrator; | ||
private EmployerAccountsConfiguration _configuration; | ||
private Mock<IMultiVariantTestingService> _userViewTestingService; | ||
private HomeController _homeController; | ||
private Mock<ICookieStorageService<FlashMessageViewModel>> _flashMessage; | ||
|
||
[SetUp] | ||
public void Arrage() | ||
{ | ||
base.Arrange(); | ||
|
||
_owinWrapper = new Mock<IAuthenticationService>(); | ||
_homeOrchestrator = new Mock<HomeOrchestrator>(); | ||
_userViewTestingService = new Mock<IMultiVariantTestingService>(); | ||
_flashMessage = new Mock<ICookieStorageService<FlashMessageViewModel>>(); | ||
_configuration = new EmployerAccountsConfiguration(); | ||
|
||
_homeController = new HomeController( | ||
_owinWrapper.Object, | ||
_homeOrchestrator.Object, | ||
_configuration, | ||
_userViewTestingService.Object, | ||
_flashMessage.Object, | ||
Mock.Of<ICookieStorageService<ReturnUrlModel>>(), | ||
Mock.Of<ILog>()) | ||
{ | ||
ControllerContext = _controllerContext.Object | ||
}; | ||
} | ||
|
||
[Test] | ||
public void ThenTheViewIsReturned() | ||
{ | ||
//Act | ||
var actual = _homeController.TermsAndConditions("returnUrl", "hashedId"); | ||
|
||
//Assert | ||
Assert.IsNotNull(actual); | ||
Assert.IsAssignableFrom<ViewResult>(actual); | ||
} | ||
|
||
[Test] | ||
public void ThenTheViewModelIsMappedCorrectly() | ||
{ | ||
//Act | ||
var result = _homeController.TermsAndConditions("returnUrl", "hashedId"); | ||
|
||
//Assert | ||
var viewResult = (ViewResult)result; | ||
var viewModel = viewResult.Model; | ||
|
||
Assert.IsInstanceOf<TermsAndConditionViewModel>(viewModel); | ||
var termsAndConditionViewModel = (TermsAndConditionViewModel)viewModel; | ||
|
||
Assert.AreEqual("returnUrl", termsAndConditionViewModel.ReturnUrl); | ||
Assert.AreEqual("hashedId", termsAndConditionViewModel.HashedAccountId); | ||
} | ||
|
||
|
||
[Test] | ||
public async Task ThenIsRedirectedToEmployerTeamController() | ||
{ | ||
var termsAndConditionViewModel = new TermsAndConditionViewModel() { HashedAccountId = "HashedId", ReturnUrl = "EmployerTeam" }; | ||
//Act | ||
var result = await _homeController.TermsAndConditions(termsAndConditionViewModel); | ||
|
||
//Assert | ||
var redirectResult = (RedirectToRouteResult)result; | ||
|
||
Assert.AreEqual("Index", redirectResult.RouteValues["action"].ToString()); | ||
Assert.AreEqual("EmployerTeam", redirectResult.RouteValues["controller"].ToString()); | ||
} | ||
|
||
[Test] | ||
public async Task ThenIsRedirectedToHomeController() | ||
{ | ||
var termsAndConditionViewModel = new TermsAndConditionViewModel() { HashedAccountId = "HashedId", ReturnUrl = "Home" }; | ||
//Act | ||
var result = await _homeController.TermsAndConditions(termsAndConditionViewModel); | ||
|
||
//Assert | ||
var redirectResult = (RedirectToRouteResult)result; | ||
|
||
Assert.AreEqual("Index", redirectResult.RouteValues["action"].ToString()); | ||
} | ||
} | ||
} |
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.