Step F first pass: 81/92 accepted; budget floor 60 calls; rejected slots moved for regeneration
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
CLASS ltc_course_booking DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA mo_environment TYPE REF TO if_osql_test_environment.
|
||||
DATA mo_cut TYPE REF TO {{P}}COURSE_BOOKING.
|
||||
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS setup.
|
||||
METHODS fill_test_data.
|
||||
|
||||
METHODS free_seats_open_course FOR TESTING.
|
||||
METHODS free_seats_full_course FOR TESTING.
|
||||
METHODS bookable_enough_seats FOR TESTING.
|
||||
METHODS not_bookable_full FOR TESTING.
|
||||
METHODS list_matching_courses FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS ltc_course_booking IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
mo_environment = cl_osql_test_environment=>create( VALUE #( ( '{{P}}COURSE' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
mo_environment->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD setup.
|
||||
mo_environment->clear_doubles( ).
|
||||
fill_test_data( ).
|
||||
mo_cut = NEW {{P}}COURSE_BOOKING( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD fill_test_data.
|
||||
DATA lt_course TYPE STANDARD TABLE OF {{P}}COURSE WITH EMPTY KEY.
|
||||
lt_course = VALUE #(
|
||||
( mandt = sy-mandt course_id = 'ABAP101' category = 'IT' title = 'ABAP Basics' capacity = 20 booked = 5 )
|
||||
( mandt = sy-mandt course_id = 'SQL101' category = 'DB' title = 'SQL Basics' capacity = 30 booked = 30 ) ).
|
||||
INSERT {{P}}COURSE FROM TABLE @lt_course.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD free_seats_open_course.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 15 act = mo_cut->get_free_seats( 'ABAP101' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD free_seats_full_course.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = mo_cut->get_free_seats( 'SQL101' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD bookable_enough_seats.
|
||||
cl_abap_unit_assert=>assert_true( mo_cut->is_bookable( iv_course_id = 'ABAP101' iv_seats = 10 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD not_bookable_full.
|
||||
cl_abap_unit_assert=>assert_false( mo_cut->is_bookable( iv_course_id = 'SQL101' iv_seats = 1 ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD list_matching_courses.
|
||||
DATA(lt_result) = mo_cut->list_bookable_courses( iv_category = 'IT' iv_seats = 1 ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_result ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 'ABAP101' act = lt_result[ 1 ]-course_id ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
Reference in New Issue
Block a user