Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
61 lines
2.8 KiB
ABAP
61 lines
2.8 KiB
ABAP
CLASS ltc_cowork_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
DATA mo_cut TYPE REF TO {{p}}cowork_fee.
|
|
METHODS setup.
|
|
METHODS hot_desk_no_discount FOR TESTING.
|
|
METHODS student_discount FOR TESTING.
|
|
METHODS under_25_discount FOR TESTING.
|
|
METHODS student_and_under_25 FOR TESTING.
|
|
METHODS invalid_desk FOR TESTING.
|
|
METHODS invalid_months FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
CLASS ltc_cowork_fee IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}cowork_fee( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD hot_desk_no_discount.
|
|
cl_abap_unit_assert=>assert_equals( exp = 200
|
|
act = mo_cut->calculate_fee( iv_desk = 'HOT' iv_months = 1
|
|
iv_student = abap_false
|
|
iv_under_25 = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD student_discount.
|
|
cl_abap_unit_assert=>assert_equals( exp = 160
|
|
act = mo_cut->calculate_fee( iv_desk = 'HOT' iv_months = 1
|
|
iv_student = abap_true
|
|
iv_under_25 = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD under_25_discount.
|
|
cl_abap_unit_assert=>assert_equals( exp = 150
|
|
act = mo_cut->calculate_fee( iv_desk = 'HOT' iv_months = 1
|
|
iv_student = abap_false
|
|
iv_under_25 = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD student_and_under_25.
|
|
" The reference resolves the contradiction in favour of the student rule.
|
|
cl_abap_unit_assert=>assert_equals( exp = 160
|
|
act = mo_cut->calculate_fee( iv_desk = 'HOT' iv_months = 1
|
|
iv_student = abap_true
|
|
iv_under_25 = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_desk.
|
|
cl_abap_unit_assert=>assert_equals( exp = 0
|
|
act = mo_cut->calculate_fee( iv_desk = 'XXX' iv_months = 1
|
|
iv_student = abap_false
|
|
iv_under_25 = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_months.
|
|
cl_abap_unit_assert=>assert_equals( exp = 0
|
|
act = mo_cut->calculate_fee( iv_desk = 'HOT' iv_months = 0
|
|
iv_student = abap_false
|
|
iv_under_25 = abap_false ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|