-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
8b205d7
commit f0dd2a8
Showing
121 changed files
with
3,212 additions
and
740 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -242,10 +242,10 @@ public async Task Should_book_hearing_for_multi_day() | |
} | ||
|
||
[Test] | ||
public async Task Should_book_hearing_with_reference_data_flag_on() | ||
public async Task Should_book_hearing_with_use_v2_api_flag_on() | ||
{ | ||
// Arrange | ||
_mocker.Mock<IFeatureToggles>().Setup(x => x.ReferenceDataToggle()).Returns(true); | ||
_mocker.Mock<IFeatureToggles>().Setup(x => x.UseV2Api()).Returns(true); | ||
var bookingDetails = InitHearingForV2Test(); | ||
|
||
var bookingRequest = new BookHearingRequest | ||
|
@@ -259,7 +259,6 @@ public async Task Should_book_hearing_with_reference_data_flag_on() | |
.WithParticipant("Individual", "[email protected]") | ||
.WithParticipant("Individual", "[email protected]") | ||
.WithParticipant("Judicial Office Holder", "[email protected]") | ||
.WithParticipant("Staff Member","[email protected]") | ||
.WithParticipant("Judge", "[email protected]"); | ||
_mocker.Mock<IBookingsApiClient>().Setup(x => x.BookNewHearingWithCodeAsync(It.IsAny<BookNewHearingRequestV2>())) | ||
.ReturnsAsync(hearingDetailsResponse); | ||
|
@@ -415,65 +414,76 @@ private BookingDetailsRequest InitHearingForV2Test() | |
{ | ||
Participants = new List<ParticipantRequest> | ||
{ | ||
new () | ||
new() | ||
{ | ||
ContactEmail = "[email protected]", | ||
HearingRoleCode = "APPL", DisplayName = "display name1", | ||
FirstName = "fname", MiddleNames = "", LastName = "lname1", Username = "[email protected]", | ||
OrganisationName = "", Representee = "", TelephoneNumber = "" | ||
}, | ||
new () | ||
new() | ||
{ | ||
ContactEmail = "[email protected]", | ||
HearingRoleCode = "APPL", DisplayName = "display name2", | ||
FirstName = "fname2", MiddleNames = "", LastName = "lname2", OrganisationName = "", | ||
Representee = "", TelephoneNumber = "", Username = "[email protected]" | ||
}, | ||
new () | ||
new() | ||
{ | ||
ContactEmail = "[email protected]", | ||
HearingRoleCode = "APPL", DisplayName = "display name3", | ||
FirstName = "fname3", MiddleNames = "", LastName = "lname3", OrganisationName = "", | ||
Representee = "", TelephoneNumber = "", Username = "[email protected]" | ||
}, | ||
new () | ||
new() | ||
{ | ||
ContactEmail = "[email protected]", | ||
HearingRoleCode = "PANL", DisplayName = "display name4", | ||
FirstName = "fname4", MiddleNames = "", LastName = "lname4", OrganisationName = "", | ||
Representee = "", TelephoneNumber = "", Username = "[email protected]" | ||
}, | ||
new () | ||
new() | ||
{ | ||
ContactEmail = "[email protected]", | ||
HearingRoleCode = "INTP", DisplayName = "display name2", | ||
FirstName = "fname5", MiddleNames = "", LastName = "lname5", OrganisationName = "", | ||
Representee = "", TelephoneNumber = "", Username = "[email protected]" | ||
} | ||
}, | ||
JudiciaryParticipants = new List<JudiciaryParticipantRequest>() | ||
{ | ||
new() | ||
{ | ||
DisplayName = "display name4", PersonalCode = "12345678", Role = "PanelMember" | ||
}, | ||
new () | ||
new() | ||
{ | ||
ContactEmail = "[email protected]", | ||
HearingRoleCode = "JUDG", DisplayName = "Judge Fudge", | ||
FirstName = "Jack", MiddleNames = "", LastName = "Fudge", | ||
Username = "[email protected]", OrganisationName = "", Representee = "", | ||
TelephoneNumber = "" | ||
DisplayName = "Judge Fudge", PersonalCode = "12345678", Role = "Judge" | ||
} | ||
}, | ||
Endpoints = new List<EndpointRequest> | ||
{ | ||
new () | ||
new() | ||
{DisplayName = "displayname1", DefenceAdvocateContactEmail = "[email protected]"}, | ||
new () | ||
new() | ||
{DisplayName = "displayname2", DefenceAdvocateContactEmail = "[email protected]"}, | ||
}, | ||
LinkedParticipants = new List<LinkedParticipantRequest> | ||
{ | ||
new () { ParticipantContactEmail = "[email protected]", LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter }, | ||
new () { ParticipantContactEmail = "[email protected]", LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter } | ||
new() | ||
{ | ||
ParticipantContactEmail = "[email protected]", | ||
LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter | ||
}, | ||
new() | ||
{ | ||
ParticipantContactEmail = "[email protected]", | ||
LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter | ||
} | ||
}, | ||
Cases = new List<CaseRequest> | ||
{ | ||
new () | ||
new() | ||
{ | ||
Name = "Case1", Number = "001", IsLeadCase = true | ||
} | ||
|
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
using AdminWebsite.UnitTests.Helper; | ||
using BookingsApi.Client; | ||
using BookingsApi.Contract.V1.Requests; | ||
using BookingsApi.Contract.V1.Requests.Enums; | ||
using BookingsApi.Contract.V1.Responses; | ||
using BookingsApi.Contract.V2.Enums; | ||
using BookingsApi.Contract.V2.Requests; | ||
|
@@ -32,6 +33,7 @@ | |
using BookingStatus = BookingsApi.Contract.V1.Enums.BookingStatus; | ||
using CaseResponse = BookingsApi.Contract.V1.Responses.CaseResponse; | ||
using EndpointResponse = BookingsApi.Contract.V1.Responses.EndpointResponse; | ||
using JudiciaryParticipantRequest = AdminWebsite.Contracts.Requests.JudiciaryParticipantRequest; | ||
using LinkedParticipantResponse = BookingsApi.Contract.V1.Responses.LinkedParticipantResponse; | ||
using LinkedParticipantType = BookingsApi.Contract.V1.Enums.LinkedParticipantType; | ||
|
||
|
@@ -358,6 +360,11 @@ public void Setup() | |
Pin = "pin", | ||
Sip = "sip" | ||
} | ||
}, | ||
JudiciaryParticipants = new List<JudiciaryParticipantResponse>() | ||
{ | ||
new (){FullName = "Judge Fudge", FirstName = "John", LastName = "Doe", HearingRoleCode = JudiciaryParticipantHearingRoleCode.Judge, PersonalCode = "1234"}, | ||
new (){FullName = "Jane Doe", FirstName = "Jane", LastName = "Doe", HearingRoleCode = JudiciaryParticipantHearingRoleCode.PanelMember, PersonalCode = "4567"} | ||
} | ||
}; | ||
} | ||
|
@@ -570,7 +577,7 @@ public async Task Should_return_updated_hearing() | |
[Test] | ||
public async Task Should_return_updated_hearingV2() | ||
{ | ||
_featureToggle.Setup(e => e.ReferenceDataToggle()).Returns(true); | ||
_featureToggle.Setup(e => e.UseV2Api()).Returns(true); | ||
var updatedHearing = _v2HearingDetailsResponse; | ||
_bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdV2Async(It.IsAny<Guid>())) | ||
.ReturnsAsync(updatedHearing) | ||
|
@@ -605,15 +612,36 @@ public async Task Should_return_updated_hearingV2() | |
LinkedParticipantContactEmail = "[email protected]", | ||
Type = AdminWebsite.Contracts.Enums.LinkedParticipantType.Interpreter | ||
} | ||
} | ||
}, | ||
}); | ||
_addNewParticipantRequest.JudiciaryParticipants = new List<JudiciaryParticipantRequest>() | ||
{ | ||
new() | ||
{ | ||
PersonalCode = "4567", DisplayName = "Jane Doe 2", Role = JudiciaryParticipantHearingRoleCode.PanelMember.ToString() | ||
}, | ||
new() | ||
{ | ||
PersonalCode = "5678", DisplayName = "New Judge Fudge", Role = JudiciaryParticipantHearingRoleCode.Judge.ToString() | ||
} | ||
}; | ||
var result = await _controller.EditHearing(_validId, _addNewParticipantRequest); | ||
var hearing = (AdminWebsite.Contracts.Responses.HearingDetailsResponse)((OkObjectResult)result.Result).Value; | ||
hearing.Id.Should().Be(updatedHearing.Id); | ||
_bookingsApiClient.Verify(x => x.UpdateHearingDetails2Async(It.IsAny<Guid>(), | ||
It.Is<UpdateHearingRequestV2>(u => | ||
!u.Cases.IsNullOrEmpty())), | ||
Times.Once); | ||
|
||
_bookingsApiClient.Verify(x => x.RemoveJudiciaryParticipantFromHearingAsync(hearing.Id, "1234"), | ||
Times.Once); | ||
|
||
_bookingsApiClient.Verify(x => x.UpdateJudiciaryParticipantAsync(hearing.Id, "4567", It.IsAny<UpdateJudiciaryParticipantRequest>()), | ||
Times.Once); | ||
|
||
_bookingsApiClient.Verify( | ||
x => x.AddJudiciaryParticipantsToHearingAsync(hearing.Id, | ||
It.IsAny<IEnumerable<BookingsApi.Contract.V1.Requests.JudiciaryParticipantRequest>>()), Times.Once); | ||
} | ||
|
||
[Test] | ||
|
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.