A method, Run for example, has several internal state, A, B, C,..., for example.
One possible call chain: User ----> Run --OnSucceed--> A_Handler --OnFail--> E_Handler and so on.
Handlers maybe called in another thread.
Because there are many state transitions in one call to Run and callback handlers may execute in other threads, so the question is:
- How to unitest such a method?
- Should I check the internal state?
- Is there any best practice for asynchronous function unit-testing?
Thanks.
Some related questions:
Aucun commentaire:
Enregistrer un commentaire