B25__Resource__c resource = [SELECT Id FROM B25__Resource__c WHERE Name = 'Resource One'];
B25__Staff__c staffMember = [SELECT Id FROM B25__Staff__c WHERE Name = 'Staff Member One'];
// first construct the context parameter
B25.BulkReservationValidator.Context context = new B25.BulkReservationValidator.Context();
context.reservationSeries = new List<List<B25.BulkReservationValidator.Reservation>>{
new List<B25.BulkReservationValidator.Reservation>{
new B25.BulkReservationValidator.Reservation(
new B25__Reservation__c(
B25__StartLocal__c = Datetime.newInstance(2020, 1, 1, 8, 0, 0),
B25__EndLocal__c = Datetime.newInstance(2020, 1, 1, 10, 0, 0),
B25__Resource__c = resource.Id,
B25__Staff__c = staffMember.Id
)
),
new B25.BulkReservationValidator.Reservation(
new B25__Reservation__c(
B25__StartLocal__c = Datetime.newInstance(2020, 2, 2, 14, 0, 0),
B25__EndLocal__c = Datetime.newInstance(2020, 2, 2, 16, 0, 0),
B25__Resource__c = resource.Id,
B25__Staff__c = staffMember.Id
)
)
}
};
// then call the method
B25.BulkReservationValidator.validate(context);
// the reservations in the context parameter now have soft and hard conflicts
for (B25.BulkReservationValidator.Reservation reservation : context.reservationSeries[0]) {
System.debug('number of soft conflicts: ' + reservation.softConflicts.size());
System.debug('number of hard conflicts: ' + reservation.hardConflicts.size());
}