Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
69 lines
3.1 KiB
ABAP
69 lines
3.1 KiB
ABAP
CLASS ltc_kennel_pricer DEFINITION FINAL FOR TESTING
|
|
DURATION SHORT RISK LEVEL HARMLESS.
|
|
PRIVATE SECTION.
|
|
TYPES ty_amount TYPE {{p}}kennel_pricer=>ty_amount.
|
|
|
|
CONSTANTS:
|
|
c_dog_1n TYPE ty_amount VALUE '25.00',
|
|
c_cat_3n_hi TYPE ty_amount VALUE '55.75',
|
|
c_dog_7n_hi TYPE ty_amount VALUE '177.17',
|
|
c_zero TYPE ty_amount VALUE '0.00',
|
|
c_bird_2n TYPE ty_amount VALUE '40.00'.
|
|
|
|
DATA mo_cut TYPE REF TO {{p}}kennel_pricer.
|
|
|
|
METHODS setup.
|
|
METHODS dog_low_season FOR TESTING.
|
|
METHODS cat_high_season FOR TESTING.
|
|
METHODS long_stay FOR TESTING.
|
|
METHODS no_nights FOR TESTING.
|
|
METHODS unknown_type FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
CLASS ltc_kennel_pricer IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}kennel_pricer( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD dog_low_season.
|
|
cl_abap_unit_assert=>assert_equals( exp = c_dog_1n
|
|
act = mo_cut->calculate_fee( iv_pet_type = 'DOG'
|
|
iv_nights = 1
|
|
iv_high_season = abap_false
|
|
iv_grooming = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD cat_high_season.
|
|
cl_abap_unit_assert=>assert_equals( exp = c_cat_3n_hi
|
|
act = mo_cut->calculate_fee( iv_pet_type = 'CAT'
|
|
iv_nights = 3
|
|
iv_high_season = abap_true
|
|
iv_grooming = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD long_stay.
|
|
cl_abap_unit_assert=>assert_equals( exp = c_dog_7n_hi
|
|
act = mo_cut->calculate_fee( iv_pet_type = 'DOG'
|
|
iv_nights = 7
|
|
iv_high_season = abap_true
|
|
iv_grooming = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD no_nights.
|
|
cl_abap_unit_assert=>assert_equals( exp = c_zero
|
|
act = mo_cut->calculate_fee( iv_pet_type = 'DOG'
|
|
iv_nights = 0
|
|
iv_high_season = abap_false
|
|
iv_grooming = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD unknown_type.
|
|
cl_abap_unit_assert=>assert_equals( exp = c_bird_2n
|
|
act = mo_cut->calculate_fee( iv_pet_type = 'BIRD'
|
|
iv_nights = 2
|
|
iv_high_season = abap_false
|
|
iv_grooming = abap_false ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|