Skip to content

Commit

Permalink
APR-1152 refreshed from master
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkFCain committed Oct 8, 2020
2 parents d43e343 + 48ae852 commit 4b3a377
Show file tree
Hide file tree
Showing 111 changed files with 3,109 additions and 1,871 deletions.
12 changes: 12 additions & 0 deletions azure/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
"sharedFrontEndAppServicePlan": {
"type": "string"
},
"sharedFrontEndSubnetResourceId": {
"type": "string"
},
"sharedBackEndAppServicePlan": {
"type": "string"
},
"sharedBackEndSubnetResourceId": {
"type": "string"
},
"configurationStorageConnectionString": {
"type": "securestring"
},
Expand Down Expand Up @@ -168,6 +174,9 @@
"appServicePlanResourceGroup": {
"value": "[parameters('sharedAppServicePlanResourceGroup')]"
},
"subnetResourceId": {
"value": "[parameters('sharedFrontEndSubnetResourceId')]"
},
"appServiceAppSettings": {
"value": [
{
Expand Down Expand Up @@ -229,6 +238,9 @@
"appServicePlanResourceGroup": {
"value": "[parameters('SharedAppServicePlanResourceGroup')]"
},
"subnetResourceId": {
"value": "[parameters('sharedBackEndSubnetResourceId')]"
},
"appServiceAppSettings": {
"value": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task Assigning_application_to_assessor_1_stored_the_assessor_detail

await _handler.Handle(new AssignAssessorRequest(applicationId, assessorNumber, expectedUserId, expectedUserName), new CancellationToken());

_repository.Verify(x => x.UpdateAssessor1(applicationId, expectedUserId,expectedUserName), Times.Once);
_repository.Verify(x => x.AssignAssessor1(applicationId, expectedUserId,expectedUserName), Times.Once);
}

[Test]
Expand All @@ -45,7 +45,7 @@ public async Task Assigning_application_to_assessor_2_stored_the_assessor_detail

await _handler.Handle(new AssignAssessorRequest(applicationId, assessorNumber, expectedUserId, expectedUserName), new CancellationToken());

_repository.Verify(x => x.UpdateAssessor2(applicationId, expectedUserId, expectedUserName), Times.Once);
_repository.Verify(x => x.AssignAssessor2(applicationId, expectedUserId, expectedUserName), Times.Once);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using SFA.DAS.ApplyService.Application.Apply;
using SFA.DAS.ApplyService.Application.Apply.Assessor;
using SFA.DAS.ApplyService.Domain.Apply.Assessor;

namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.CreateEmptyAssessorReviewHandlerTests
{
[TestFixture]
public class CreateEmptyAssessorReviewHandlerTests
{
private Mock<IAssessorRepository> _repository;
private CreateEmptyAssessorReviewHandler _handler;

[SetUp]
public void Setup()
{
_repository = new Mock<IAssessorRepository>();
_handler = new CreateEmptyAssessorReviewHandler(_repository.Object, Mock.Of<ILogger<CreateEmptyAssessorReviewHandler>>());
}


[Test]
public async Task When_creating_empty_review_AssessorPageOutcomes_are_stored()
{
var applicationId = Guid.NewGuid();
var userId = Guid.NewGuid().ToString();

var pageReviewOutcomes = new List<AssessorPageReviewOutcome>
{
new AssessorPageReviewOutcome
{
ApplicationId = Guid.NewGuid(),
SequenceNumber = 1,
SectionNumber = 2,
AssessorNumber = 1,
PageId = Guid.NewGuid().ToString(),
UserId = Guid.NewGuid().ToString()
},
new AssessorPageReviewOutcome
{
ApplicationId = Guid.NewGuid(),
SequenceNumber = 3,
SectionNumber = 4,
AssessorNumber = 2,
PageId = Guid.NewGuid().ToString(),
UserId = Guid.NewGuid().ToString()
}
};

var request = new CreateEmptyAssessorReviewRequest(applicationId, userId, pageReviewOutcomes);

await _handler.Handle(request, new CancellationToken());

_repository.Verify(x => x.CreateEmptyAssessorReview(request.ApplicationId, request.AssessorUserId, request.PageReviewOutcomes), Times.Once);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using SFA.DAS.ApplyService.Application.Apply;
using SFA.DAS.ApplyService.Application.Apply.Moderator;
using SFA.DAS.ApplyService.Domain.Apply.Moderator;

namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.CreateEmptyModeratorReviewHandlerTests
{
[TestFixture]
public class CreateEmptyModeratorReviewHandlerTests
{
private Mock<IModeratorRepository> _repository;
private CreateEmptyModeratorReviewHandler _handler;

[SetUp]
public void Setup()
{
_repository = new Mock<IModeratorRepository>();
_handler = new CreateEmptyModeratorReviewHandler(_repository.Object, Mock.Of<ILogger<CreateEmptyModeratorReviewHandler>>());
}

[Test]
public async Task When_creating_empty_review_ModeratorPageOutcomes_are_stored()
{
var applicationId = Guid.NewGuid();
var userId = Guid.NewGuid().ToString();

var pageReviewOutcomes = new List<ModeratorPageReviewOutcome>
{
new ModeratorPageReviewOutcome
{
ApplicationId = Guid.NewGuid(),
SequenceNumber = 1,
SectionNumber = 2,
PageId = Guid.NewGuid().ToString(),
UserId = Guid.NewGuid().ToString()
},
new ModeratorPageReviewOutcome
{
ApplicationId = Guid.NewGuid(),
SequenceNumber = 3,
SectionNumber = 4,
PageId = Guid.NewGuid().ToString(),
UserId = Guid.NewGuid().ToString()
}
};

var request = new CreateEmptyModeratorReviewRequest(applicationId, userId, pageReviewOutcomes);

await _handler.Handle(request, new CancellationToken());

_repository.Verify(x => x.CreateEmptyModeratorReview(request.ApplicationId, request.ModeratorUserId, request.PageReviewOutcomes), Times.Once);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.GetAllModeratorPag
[TestFixture]
public class GetAllModeratorPageReviewOutcomesHandlerTests
{
protected Mock<IAssessorRepository> _repository;
protected Mock<IModeratorRepository> _repository;
protected GetAllModeratorPageReviewOutcomesHandler _handler;

[SetUp]
public void TestSetup()
{
_repository = new Mock<IAssessorRepository>();
_repository = new Mock<IModeratorRepository>();
_handler = new GetAllModeratorPageReviewOutcomesHandler(_repository.Object, Mock.Of<ILogger<GetAllModeratorPageReviewOutcomesHandler>>());
}

Expand All @@ -34,7 +34,6 @@ public async Task GetAllModeratorReviewOutcomesHandler_returns__List_of_PageRevi
var expectedUserId = "4fs7f-userId-7gfhh";
var expectedStatus = "Fail";
var expectedComment = "Very bad";
var expectedExtneralComment = "Extneral very bad";

var expectedResult = new List<ModeratorPageReviewOutcome>
{
Expand All @@ -46,8 +45,7 @@ public async Task GetAllModeratorReviewOutcomesHandler_returns__List_of_PageRevi
PageId = expectedPageId,
UserId = expectedUserId,
Status = expectedStatus,
Comment = expectedComment,
ExternalComment = expectedExtneralComment
Comment = expectedComment
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using SFA.DAS.ApplyService.Application.Apply;
using SFA.DAS.ApplyService.Application.Apply.GetApplications;

namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.GetApplicationByUserIdHandlerTests
{
public class When_application_by_userid_is_requested
{
protected Mock<IApplyRepository> ApplyRepository;
protected GetApplicationByUserIdHandler IdHandler;

[SetUp]
public void Setup()
{
ApplyRepository = new Mock<IApplyRepository>();
ApplyRepository.Setup(r => r.GetApplicationByUserId(It.IsAny<Guid>(), It.IsAny<Guid>())).ReturnsAsync(new Domain.Entities.Apply());
IdHandler = new GetApplicationByUserIdHandler(ApplyRepository.Object);
}

[Test]
public async Task Then_application_for_user_are_returned()
{
var applicationId = Guid.NewGuid();
var signinId = Guid.NewGuid();
await IdHandler.Handle(new GetApplicationByUserIdRequest(applicationId, signinId), new CancellationToken());
ApplyRepository.Verify(r => r.GetApplicationByUserId(applicationId, signinId), Times.Once);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;
using SFA.DAS.ApplyService.Application.Apply;
using SFA.DAS.ApplyService.Application.Apply.Moderator;
using SFA.DAS.ApplyService.Domain.Apply.Moderator;
using System;
using System.Threading;
using System.Threading.Tasks;

namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.GetBlindAssessmentOutcomeHandlerTests
{
[TestFixture]
public class GetBlindAssessmentOutcomeHandlerTests
{
protected Mock<IModeratorRepository> _repository;
protected GetBlindAssessmentOutcomeHandler _handler;

[SetUp]
public void TestSetup()
{
_repository = new Mock<IModeratorRepository>();
_handler = new GetBlindAssessmentOutcomeHandler(_repository.Object, Mock.Of<ILogger<GetBlindAssessmentOutcomeHandler>>());
}

[Test]
public async Task GetBlindAssessmentOutcomeHandler_returns__BlindAssessmentOutcome()
{
var applicationId = Guid.NewGuid();
var sequenceNumber = 1;
var sectionNumber = 2;
var pageId = "30";

var expectedResult = new BlindAssessmentOutcome
{
Assessor1Name = "Assessor 1",
Assessor1ReviewStatus = "Pass",
Assessor1ReviewComment = "",
Assessor2Name = "Assessor 2",
Assessor2ReviewStatus = "Failed",
Assessor2ReviewComment = "Very bad"
};

_repository.Setup(x => x.GetBlindAssessmentOutcome(applicationId, sequenceNumber, sectionNumber, pageId)).ReturnsAsync(expectedResult);

var actualResult = await _handler.Handle(new GetBlindAssessmentOutcomeRequest(applicationId, sequenceNumber, sectionNumber, pageId), new CancellationToken());

Assert.AreSame(expectedResult, actualResult);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.GetModeratorPageRe
[TestFixture]
public class GetModeratorPageReviewOutcomeHandlerTests
{
protected Mock<IAssessorRepository> _repository;
protected Mock<IModeratorRepository> _repository;
protected GetModeratorPageReviewOutcomeHandler _handler;

[SetUp]
public void TestSetup()
{
_repository = new Mock<IAssessorRepository>();
_repository = new Mock<IModeratorRepository>();
_handler = new GetModeratorPageReviewOutcomeHandler(_repository.Object, Mock.Of<ILogger<GetModeratorPageReviewOutcomeHandler>>());
}

Expand All @@ -33,7 +33,6 @@ public async Task GetModeratorPageReviewOutcomeHandler_returns__PageReviewOutcom
var expectedUserId = "4fs7f-userId-7gfhh";
var expectedStatus = "Fail";
var expectedComment = "Very bad";
var expectedExtneralComment = "External very bad";

var expectedResult = new ModeratorPageReviewOutcome
{
Expand All @@ -43,8 +42,7 @@ public async Task GetModeratorPageReviewOutcomeHandler_returns__PageReviewOutcom
PageId = expectedPageId,
UserId = expectedUserId,
Status = expectedStatus,
Comment = expectedComment,
ExternalComment = expectedExtneralComment
Comment = expectedComment
};

_repository.Setup(x => x.GetModeratorPageReviewOutcome(expectedApplicationId, expectedSequenceNumber, expectedSectionNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ namespace SFA.DAS.ApplyService.Application.UnitTests.Handlers.GetModeratorPageRe
[TestFixture]
public class GetModeratorPageReviewOutcomesForSectionHandlerTests
{
protected Mock<IAssessorRepository> _repository;
protected Mock<IModeratorRepository> _repository;
protected GetModeratorPageReviewOutcomesForSectionHandler _handler;

[SetUp]
public void TestSetup()
{
_repository = new Mock<IAssessorRepository>();
_repository = new Mock<IModeratorRepository>();
_handler = new GetModeratorPageReviewOutcomesForSectionHandler(_repository.Object, Mock.Of<ILogger<GetModeratorPageReviewOutcomesForSectionHandler>>());
}

Expand All @@ -34,7 +34,6 @@ public async Task GetModeratorPageReviewOutcomesForSectionHandler_returns__List_
var expectedUserId = "4fs7f-userId-7gfhh";
var expectedStatus = "Fail";
var expectedComment = "Very bad";
var expectedExtneralComment = "External very bad";

var expectedResult = new List<ModeratorPageReviewOutcome>
{
Expand All @@ -46,8 +45,7 @@ public async Task GetModeratorPageReviewOutcomesForSectionHandler_returns__List_
PageId = expectedPageId,
UserId = expectedUserId,
Status = expectedStatus,
Comment = expectedComment,
ExternalComment = expectedExtneralComment
Comment = expectedComment
}
};

Expand Down
Loading

0 comments on commit 4b3a377

Please sign in to comment.