Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…mployerapprenticeshipsservice into CON-1712-TechDept
  • Loading branch information
reachash committed May 1, 2020
2 parents 4927d09 + de55f6d commit 9b57072
Show file tree
Hide file tree
Showing 67 changed files with 905 additions and 1,216 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -85,7 +85,7 @@
<Version>4.5.28</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>10.0.3</Version>
<Version>11.0.1</Version>
</PackageReference>
<PackageReference Include="NUnit">
<Version>3.10.1</Version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="3.18.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="SFA.DAS.Common.Domain" Version="1.4.283" />
</ItemGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ SELECT DATEADD(dd, DATEDIFF(dd, 0, tl.DateCreated), 0) AS DateCreated,
NULL AS TransferReceiverAccountName
FROM [employer_financial].TransactionLine tl
LEFT JOIN [employer_financial].[TransactionLineTypes] tlt
ON tlt.TransactionType = 3
ON tlt.TransactionType = 5
WHERE tl.AccountId = @accountId
AND DateCreated >= @FromDate
AND DateCreated < @ToDate
AND tl.TransactionType = 5
AND tl.Amount > 0
AND tl.Amount <> 0

UNION ALL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@
using Moq;
using NUnit.Framework;
using SFA.DAS.Authentication;
using SFA.DAS.Authorization.Services;
using SFA.DAS.EmployerAccounts.Interfaces;
using SFA.DAS.EmployerAccounts.Web.Controllers;
using SFA.DAS.EmployerAccounts.Web.Orchestrators;
using SFA.DAS.EmployerAccounts.Web.ViewModels;

namespace SFA.DAS.EmployerAccounts.Web.UnitTests.Controllers.EmployerTeamControllerTests.WhenHomePageToggleIsEnabled
namespace SFA.DAS.EmployerAccounts.Web.UnitTests.Controllers.EmployerTeamControllerTests
{
public class WhenAgreementToSign
{
private EmployerTeamController _controller;

private Mock<IAuthenticationService> mockAuthenticationService;
private Mock<IAuthorizationService> mockAuthorizationService;
private Mock<IMultiVariantTestingService> mockMultiVariantTestingService;
private Mock<ICookieStorageService<FlashMessageViewModel>> mockCookieStorageService;
private Mock<EmployerTeamOrchestrator> mockEmployerTeamOrchestrator;
Expand All @@ -24,94 +22,36 @@ public class WhenAgreementToSign
public void Arrange()
{
mockAuthenticationService = new Mock<IAuthenticationService>();
mockAuthorizationService = new Mock<IAuthorizationService>();
mockMultiVariantTestingService = new Mock<IMultiVariantTestingService>();
mockCookieStorageService = new Mock<ICookieStorageService<FlashMessageViewModel>>();
mockEmployerTeamOrchestrator = new Mock<EmployerTeamOrchestrator>();
mockAuthorizationService.Setup(m => m.IsAuthorized("EmployerFeature.CallToAction")).Returns(false);

_controller = new EmployerTeamController(
mockAuthenticationService.Object,
mockMultiVariantTestingService.Object,
mockCookieStorageService.Object,
mockEmployerTeamOrchestrator.Object,
mockAuthorizationService.Object);
mockEmployerTeamOrchestrator.Object);
}

[Test]
public void ThenTheSignAgreementViewIsReturnedAtRow1Panel1()
{
// Arrange
var model = new AccountDashboardViewModel();
model.PayeSchemeCount = 1;
model.CallToActionViewModel = new CallToActionViewModel
var model = new AccountDashboardViewModel
{
AgreementsToSign = true
};

//Act
var result = _controller.Row1Panel1(model) as PartialViewResult;

//Assert
Assert.IsNotNull(result);
Assert.AreEqual("Empty", (result.Model as dynamic).ViewName);
}

[Test]
public void ThenTheTasksViewIsReturnedAtRow1Panel2()
{
// Arrange
var model = new AccountDashboardViewModel();
model.PayeSchemeCount = 1;
model.CallToActionViewModel = new CallToActionViewModel
{
AgreementsToSign = true
PayeSchemeCount = 1,
CallToActionViewModel = new CallToActionViewModel
{
AgreementsToSign = true
}
};

//Act
var result = _controller.Row1Panel2(model) as PartialViewResult;

//Assert
Assert.IsNotNull(result);
Assert.AreEqual("Tasks", (result.Model as dynamic).ViewName);
}

[Test]
public void ThenTheDashboardViewIsReturnedAtRow2Panel1()
{
// Arrange
var model = new AccountDashboardViewModel();
model.PayeSchemeCount = 1;
model.CallToActionViewModel = new CallToActionViewModel
{
AgreementsToSign = true
};

//Act
var result = _controller.Row2Panel1(model) as PartialViewResult;

//Assert
Assert.IsNotNull(result);
Assert.AreEqual("Dashboard", (result.Model as dynamic).ViewName);
}

[Test]
public void ThenTheEmptyViewIsReturnedAtRow2Panel2()
{
// Arrange
var model = new AccountDashboardViewModel();
model.PayeSchemeCount = 1;
model.CallToActionViewModel = new CallToActionViewModel
{
AgreementsToSign = true
};

//Act
var result = _controller.Row2Panel2(model) as PartialViewResult;
var result = _controller.Row1Panel1(model) as PartialViewResult;

//Assert
Assert.IsNotNull(result);
Assert.AreEqual("Empty", (result.Model as dynamic).ViewName);
Assert.AreEqual("SignAgreement", (result.Model as dynamic).ViewName);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Web.Mvc;
using Moq;
using NUnit.Framework;
using SFA.DAS.Authentication;
using SFA.DAS.Authorization.Services;
using SFA.DAS.EmployerAccounts.Interfaces;
using SFA.DAS.EmployerAccounts.Web.Controllers;
using SFA.DAS.EmployerAccounts.Web.Helpers;
using SFA.DAS.EmployerAccounts.Web.Orchestrators;
using SFA.DAS.EmployerAccounts.Web.ViewModels;

namespace SFA.DAS.EmployerAccounts.Web.UnitTests.Controllers.EmployerTeamControllerTests.WhenCallToActionToggleIsEnabled
{
public class WhenIChooseIIfIKnowApprenticehipStartDate
{
private EmployerTeamController _controller;

private Mock<IAuthenticationService> mockAuthenticationService;
private Mock<IMultiVariantTestingService> mockMultiVariantTestingService;
private Mock<ICookieStorageService<FlashMessageViewModel>> mockCookieStorageService;
private Mock<EmployerTeamOrchestrator> mockEmployerTeamOrchestrator;

[SetUp]
public void Arrange()
{
mockAuthenticationService = new Mock<IAuthenticationService>();
mockMultiVariantTestingService = new Mock<IMultiVariantTestingService>();
mockCookieStorageService = new Mock<ICookieStorageService<FlashMessageViewModel>>();
mockEmployerTeamOrchestrator = new Mock<EmployerTeamOrchestrator>();

_controller = new EmployerTeamController(
mockAuthenticationService.Object,
mockMultiVariantTestingService.Object,
mockCookieStorageService.Object,
mockEmployerTeamOrchestrator.Object);
}

[Test]
public void IfIChooseYesIContinueTheJourney()
{
//Act
var result = _controller.TriageWillApprenticeshipTrainingStart(new TriageViewModel {TriageOption = TriageOptions.Yes}) as RedirectToRouteResult;

//Assert
Assert.AreEqual(ControllerConstants.TriageApprenticeForExistingEmployeeActionName, result.RouteValues["Action"]);
}

[Test]
public void IfIChooseNoICannotSetupAnApprentice()
{
//Act
var result = _controller.TriageWillApprenticeshipTrainingStart(new TriageViewModel { TriageOption = TriageOptions.No }) as RedirectToRouteResult;

//Assert
Assert.AreEqual(ControllerConstants.TriageYouCannotSetupAnApprenticeshipYetStartDateActionName, result.RouteValues["Action"]);
}

[Test]
public void IfIChooseDontKnowICannotSetupAnApprentice()
{
//Act
var result = _controller.TriageWillApprenticeshipTrainingStart(new TriageViewModel { TriageOption = TriageOptions.Unknown }) as RedirectToRouteResult;

//Assert
Assert.AreEqual(ControllerConstants.TriageYouCannotSetupAnApprenticeshipYetApproximateStartDateActionName, result.RouteValues["Action"]);
}
}
}
Loading

0 comments on commit 9b57072

Please sign in to comment.