Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
65 lines
2.2 KiB
ABAP
65 lines
2.2 KiB
ABAP
CLASS ltc_marina_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
DATA mo_cut TYPE REF TO {{p}}marina_fee.
|
|
METHODS setup.
|
|
METHODS minimum_fee_applies FOR TESTING.
|
|
METHODS week_discount FOR TESTING.
|
|
METHODS motor_in_high_season FOR TESTING.
|
|
METHODS invalid_input_returns_zero FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS ltc_marina_fee IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}marina_fee( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD minimum_fee_applies.
|
|
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
|
lv_exp = '30.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 6
|
|
iv_nights = 1
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD week_discount.
|
|
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
|
lv_exp = '201.60'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 12
|
|
iv_nights = 7
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD motor_in_high_season.
|
|
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
|
lv_exp = '107.52'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 10
|
|
iv_nights = 2
|
|
iv_boat_type = 'M'
|
|
iv_season = 'H'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_input_returns_zero.
|
|
DATA lv_exp TYPE {{p}}marina_fee=>ty_fee.
|
|
lv_exp = '0.00'.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = lv_exp
|
|
act = mo_cut->calculate_fee( iv_length_m = 0
|
|
iv_nights = 3
|
|
iv_boat_type = 'S'
|
|
iv_season = 'L'
|
|
iv_power = abap_false ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|