-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
3,109 additions
and
1,871 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
63 changes: 63 additions & 0 deletions
63
...s/Handlers/CreateEmptyAssessorReviewHandlerTests/CreateEmptyAssessorReviewHandlerTests.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,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); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...Handlers/CreateEmptyModeratorReviewHandlerTests/CreateEmptyModeratorReviewHandlerTests.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,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); | ||
} | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...ests/Handlers/GetApplicationByUserIdHandlerTests/When_application_by_user_is_requested.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,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); | ||
} | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
...s/Handlers/GetBlindAssessmentOutcomeHandlerTests/GetBlindAssessmentOutcomeHandlerTests.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,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); | ||
} | ||
} | ||
} |
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.