Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CLASS ltd_fake_invoice_operator DEFINITION FOR TESTING.
- PUBLIC SECTION.
- INTERFACES: <aquelas interfaces de modifier, retriever & so on>
- METHODS put IMPORTING invoice <...bla>
- METHODS get IMPORTING id TYPE <...invoice id bla>
- RETURNING value(return) TYPE <invoice type bla>
- ENDCLASS.
- CLASS ltd_fake_invoice_operator IMPLEMENTATION.
- < BLA BLA >.
- ENDCLASS.
- CLASS ltc_invoid_paid_action DEFINITION FOR TESTING
- INHERITING FROM /deal/tct_bobf_operations_test
- DURATION SHORT
- RISK LEVEL HARMLESS.
- PRIVATE SECTION.
- DATA fake_invoice_operator TYPE REF TO ltd_fake_invoice_operator.
- METHODS:
- setup,
- <helpers bla>,
- update_invoice_to_paid FOR TESTING,
- update_invoices_to_paid_value FOR TESTING,
- no_invoices_retrieved FOR TESTING.
- ENDCLASS.
- CLASS ltc_invoid_paid_action IMPLEMENTATION.
- METHOD setup.
- me->setup_test_infrastructure( ).
- fake_invoice_operator = NEW ltd_fake_invoice_operator( ).
- ENDMETHOD.
- METHOD update_invoice_to_paid.
- given_invoice( id = '123' payment_status = '01' ).
- when_updating_invoice_to_paid( id = '123' ).
- then_invoice_should_be_updated( id = '123' payment_status = '02' ).
- ENDMETHOD.
- METHOD given_invoice.
- DATA(invoice) = VALUE zec_t_cust_invoice_root_d(
- ( key = |{ id }_key|
- invoice_id = id
- payment_status = payment_status ) ).
- fake_invoice_operator->put( invoice ).
- ENDMETHOD.
- METHOD when_updating_invoice_to_paid.
- execute_action(
- i_action = NEW zec_a_invoice_paid( )
- i_context = VALUE #( )
- i_keys = VALUE #( ( key = |{ id }_key| ) )
- ).
- ENDMETHOD.
- METHOD then_invoice_should_be_updated.
- DATA(actual_invoice) = fake_invoice_operator->get( id ).
- cl_abap_unit_assert=>assert_equals(
- exp = payment_status
- act = actual-payment_status
- ).
- ENDMETHOD.
- <bla bla>
Advertisement
Add Comment
Please, Sign In to add comment