Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,22 @@ public async Task AssertSessionNoLongerExists(string dateString)

dayAvailabilityDocument.Resource.Sessions.Length.Should().Be(0);
}

[Then("the following updated sessions exist for a created default site")]
public async Task AssertSessionsOnDate(DataTable dataTable)
{
var expectedAvailabilityDocuments = DailyAvailabilityDocumentsFromTable(GetSiteId(), dataTable).ToList();

foreach (var expectedAvailabilityDocument in expectedAvailabilityDocuments)
{
var documentId = expectedAvailabilityDocument.Date.ToString("yyyyMMdd");

var actualDayAvailabilityDocument = await Client.GetContainer("appts", "booking_data")
.ReadItemAsync<DailyAvailabilityDocument>(documentId, new PartitionKey(GetSiteId()));

actualDayAvailabilityDocument.Resource.Sessions.Should().BeEquivalentTo(expectedAvailabilityDocument.Sessions);
}
}

[Given("the following sites exist in the system")]
public async Task SetUpSites(DataTable dataTable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public async Task UpdateSession(string newlyUnsupportedBookingAction, DataTable
}

[When(@"I replace a session with a replacement and set newlyUnsupportedBookingAction to '(.+)'")]
[And(@"I replace a session with a replacement and set newlyUnsupportedBookingAction to '(.+)'")]
public async Task EditSessionReplacement(string newlyUnsupportedBookingAction, DataTable editSessions)
{
Session matcher = null;
Expand Down Expand Up @@ -122,6 +123,7 @@ public async Task EditSessionReplacement(string newlyUnsupportedBookingAction, D
// }

[When("I cancel the following session using the edit endpoint and set newlyUnsupportedBookingAction to '(.+)'")]
[And("I cancel the following session using the edit endpoint and set newlyUnsupportedBookingAction to '(.+)'")]
public async Task CancelSingleSession(string newlyUnsupportedBookingAction, DataTable dataTable)
{
var row = dataTable.Rows.ElementAt(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,58 @@ Feature: Change Session Uplifted Journey
Then the booking with reference '324524-00008' has status 'Cancelled'
Then the booking with reference '324524-00009' has status 'Cancelled'
Then the booking with reference '324524-00010' has status 'Cancelled'


Scenario: Multiple consecutive patches on a single document should return a consistent outcome
Given the following sessions exist for a created default site
| Date | From | Until | Services | Slot Length | Capacity |
| 10 days from today | 09:00 | 09:10 | A,B,C,D | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A,B,C,E | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A,B,C,F | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A,B | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A,B,C | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | B | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | C | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | D | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | E | 10 | 5 |
And the following bookings have been made
| Date | Time | Duration | Service | Reference |
| 10 days from today | 09:00 | 10 | A | 324524-00001 |
| 10 days from today | 09:00 | 10 | B | 324524-00002 |
| 10 days from today | 09:00 | 10 | C | 324524-00003 |
| 10 days from today | 09:00 | 10 | D | 324524-00004 |
| 10 days from today | 09:00 | 10 | E | 324524-00005 |
| 10 days from today | 09:00 | 10 | F | 324524-00006 |
When I replace a session with a replacement and set newlyUnsupportedBookingAction to 'Cancel'
| Type | RequestFrom | RequestTo | From | Until | Services | SlotLength | Capacity |
| Matcher | 10 days from today | 10 days from today | 09:00 | 09:10 | A,B,C,D | 10 | 5 |
| Replacement | | | 09:00 | 09:10 | B,C,D | 10 | 5 |
And I replace a session with a replacement and set newlyUnsupportedBookingAction to 'Cancel'
| Type | RequestFrom | RequestTo | From | Until | Services | SlotLength | Capacity |
| Matcher | 10 days from today | 10 days from today | 09:00 | 09:10 | A,B,C,E | 10 | 5 |
| Replacement | | | 09:00 | 09:10 | B,C,E | 10 | 5 |
And I replace a session with a replacement and set newlyUnsupportedBookingAction to 'Cancel'
| Type | RequestFrom | RequestTo | From | Until | Services | SlotLength | Capacity |
| Matcher | 10 days from today | 10 days from today | 09:00 | 09:10 | A,B,C,F | 10 | 5 |
| Replacement | | | 09:00 | 09:10 | B,C,F | 10 | 5 |
And I cancel the following session using the edit endpoint and set newlyUnsupportedBookingAction to 'Cancel'
| Date | From | Until | Services | Slot Length | Capacity |
| 10 days from today | 09:00 | 09:10 | C | 10 | 5 |
And I cancel the following session using the edit endpoint and set newlyUnsupportedBookingAction to 'Cancel'
| Date | From | Until | Services | Slot Length | Capacity |
| 10 days from today | 09:00 | 09:10 | D | 10 | 5 |
And I replace a session with a replacement and set newlyUnsupportedBookingAction to 'Cancel'
| Type | RequestFrom | RequestTo | From | Until | Services | SlotLength | Capacity |
| Matcher | 10 days from today | 10 days from today | 09:00 | 09:10 | A,B,C | 10 | 5 |
| Replacement | | | 09:00 | 09:10 | A,B,C,D,E | 10 | 5 |
Then the following updated sessions exist for a created default site
| Date | From | Until | Services | Slot Length | Capacity |
| 10 days from today | 09:00 | 09:10 | B,C,D | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | B,C,E | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | B,C,F | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A,B | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A,B,C,D,E | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | A | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | B | 10 | 5 |
| 10 days from today | 09:00 | 09:10 | E | 10 | 5 |