52 lines
1.6 KiB
ABAP
52 lines
1.6 KiB
ABAP
CLASS ltc_tent_hire_fee DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
DATA mo_cut TYPE REF TO {{p}}if_tent_hire.
|
|
METHODS setup.
|
|
METHODS small_tent_one_day FOR TESTING.
|
|
METHODS small_tent_five_days FOR TESTING.
|
|
METHODS medium_tent_three_days FOR TESTING.
|
|
METHODS large_tent_seven_days FOR TESTING.
|
|
METHODS unknown_size FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS ltc_tent_hire_fee IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}tent_hire_fee( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD small_tent_one_day.
|
|
" 1 * 45.00 + 30.00 = 75.00; plus 19% VAT = 89.25
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = '89.25'
|
|
act = mo_cut->calculate_fee( iv_tent_size = 'S' iv_days = 1 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD small_tent_five_days.
|
|
" 5 * 45.00 + 30.00 = 255.00; less 10% = 229.50; plus 19% VAT = 273.105
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = '273.11'
|
|
act = mo_cut->calculate_fee( iv_tent_size = 'S' iv_days = 5 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD medium_tent_three_days.
|
|
" 3 * 68.00 + 40.00 = 244.00; plus 19% VAT = 290.36
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = '290.36'
|
|
act = mo_cut->calculate_fee( iv_tent_size = 'M' iv_days = 3 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD large_tent_seven_days.
|
|
" 7 * 95.00 + 55.00 = 720.00; less 10% = 648.00; plus 19% VAT = 771.12
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = '771.12'
|
|
act = mo_cut->calculate_fee( iv_tent_size = 'L' iv_days = 7 ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD unknown_size.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = '0.00'
|
|
act = mo_cut->calculate_fee( iv_tent_size = 'X' iv_days = 2 ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|