Is there a way to unit test an async method?
- by Jiho Han
I am using Xunit and NMock on .NET platform.
I am testing a presentation model where a method is asynchronous.
The method creates an async task and executes it so the method returns immediately and the state I need to check aren't ready yet.
I can set a flag upon finish without modifying the SUT but that would mean I would have to keep checking the flag in a while loop for example, with perhaps timeout.
What are my options?