Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
75 lines
3.1 KiB
ABAP
75 lines
3.1 KiB
ABAP
CLASS ltc_locksmith_pricer DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
DATA mo_cut TYPE REF TO {{p}}if_locksmith_pricer.
|
|
METHODS setup.
|
|
METHODS dup_standard FOR TESTING.
|
|
METHODS dup_discount FOR TESTING.
|
|
METHODS dup_high_discount FOR TESTING.
|
|
METHODS lockout_late FOR TESTING.
|
|
METHODS rekey_standard FOR TESTING.
|
|
METHODS unknown_job FOR TESTING.
|
|
METHODS assert_price
|
|
IMPORTING iv_expected TYPE {{p}}if_locksmith_pricer=>ty_amount
|
|
iv_actual TYPE {{p}}if_locksmith_pricer=>ty_amount.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS ltc_locksmith_pricer IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}locksmith_pricer( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD dup_standard.
|
|
assert_price( iv_expected = '13.50'
|
|
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
|
iv_quantity = 3
|
|
iv_key_type = 'S'
|
|
iv_callout = 'N' ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD dup_discount.
|
|
assert_price( iv_expected = '20.25'
|
|
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
|
iv_quantity = 5
|
|
iv_key_type = 'S'
|
|
iv_callout = 'N' ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD dup_high_discount.
|
|
assert_price( iv_expected = '156.80'
|
|
iv_actual = mo_cut->calculate_price( iv_job_type = 'K'
|
|
iv_quantity = 20
|
|
iv_key_type = 'Y'
|
|
iv_callout = 'N' ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD lockout_late.
|
|
assert_price( iv_expected = '149.00'
|
|
iv_actual = mo_cut->calculate_price( iv_job_type = 'L'
|
|
iv_quantity = 0
|
|
iv_key_type = 'X'
|
|
iv_callout = 'A' ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD rekey_standard.
|
|
assert_price( iv_expected = '82.00'
|
|
iv_actual = mo_cut->calculate_price( iv_job_type = 'R'
|
|
iv_quantity = 2
|
|
iv_key_type = 'S'
|
|
iv_callout = 'N' ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD unknown_job.
|
|
assert_price( iv_expected = '0.00'
|
|
iv_actual = mo_cut->calculate_price( iv_job_type = 'X'
|
|
iv_quantity = 1
|
|
iv_key_type = 'S'
|
|
iv_callout = 'N' ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD assert_price.
|
|
cl_abap_unit_assert=>assert_equals( exp = iv_expected
|
|
act = iv_actual ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|