134 lines
4.3 KiB
ABAP
134 lines
4.3 KiB
ABAP
CLASS {{p}}sweep_hidden DEFINITION
|
|
PUBLIC
|
|
FINAL
|
|
CREATE PUBLIC
|
|
FOR TESTING
|
|
DURATION SHORT
|
|
RISK LEVEL HARMLESS.
|
|
|
|
PRIVATE SECTION.
|
|
TYPES ty_fee TYPE p LENGTH 8 DECIMALS 2.
|
|
|
|
DATA mo_cut TYPE REF TO {{p}}sweep_pricer.
|
|
|
|
METHODS setup.
|
|
METHODS min_fee_house FOR TESTING.
|
|
METHODS min_fee_apartment FOR TESTING.
|
|
METHODS soot_three_surcharge FOR TESTING.
|
|
METHODS soot_five_surcharge FOR TESTING.
|
|
METHODS volume_discount FOR TESTING.
|
|
METHODS discount_with_soot FOR TESTING.
|
|
METHODS express_surcharge FOR TESTING.
|
|
METHODS express_over_minimum FOR TESTING.
|
|
METHODS unknown_building_zero FOR TESTING.
|
|
METHODS no_flues_zero FOR TESTING.
|
|
METHODS invalid_soot_no_surcharge FOR TESTING.
|
|
ENDCLASS.
|
|
|
|
|
|
|
|
CLASS {{p}}sweep_hidden IMPLEMENTATION.
|
|
METHOD setup.
|
|
mo_cut = NEW {{p}}sweep_pricer( ).
|
|
ENDMETHOD.
|
|
|
|
METHOD min_fee_house.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '60.00' )
|
|
act = mo_cut->calculate( iv_flues = 1
|
|
iv_building = 'H'
|
|
iv_soot = 1
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD min_fee_apartment.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '60.00' )
|
|
act = mo_cut->calculate( iv_flues = 1
|
|
iv_building = 'A'
|
|
iv_soot = 1
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD soot_three_surcharge.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '99.00' )
|
|
act = mo_cut->calculate( iv_flues = 2
|
|
iv_building = 'H'
|
|
iv_soot = 3
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD soot_five_surcharge.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '216.00' )
|
|
act = mo_cut->calculate( iv_flues = 3
|
|
iv_building = 'R'
|
|
iv_soot = 5
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD volume_discount.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '132.30' )
|
|
act = mo_cut->calculate( iv_flues = 4
|
|
iv_building = 'A'
|
|
iv_soot = 2
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD discount_with_soot.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '186.30' )
|
|
act = mo_cut->calculate( iv_flues = 4
|
|
iv_building = 'H'
|
|
iv_soot = 4
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD express_surcharge.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '115.00' )
|
|
act = mo_cut->calculate( iv_flues = 2
|
|
iv_building = 'H'
|
|
iv_soot = 1
|
|
iv_express = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD express_over_minimum.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '67.00' )
|
|
act = mo_cut->calculate( iv_flues = 1
|
|
iv_building = 'A'
|
|
iv_soot = 5
|
|
iv_express = abap_true ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD unknown_building_zero.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '0.00' )
|
|
act = mo_cut->calculate( iv_flues = 3
|
|
iv_building = 'X'
|
|
iv_soot = 3
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD no_flues_zero.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '0.00' )
|
|
act = mo_cut->calculate( iv_flues = 0
|
|
iv_building = 'H'
|
|
iv_soot = 3
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_soot_no_surcharge.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = CONV ty_fee( '90.00' )
|
|
act = mo_cut->calculate( iv_flues = 2
|
|
iv_building = 'H'
|
|
iv_soot = 0
|
|
iv_express = abap_false ) ).
|
|
ENDMETHOD.
|
|
ENDCLASS.
|