I am using System.Threading.Tasks to execute my long running service calls and using ContinueWith to update my ViewModel. To unit test this view model updation after task excecution I have exposed the Task returned by ContinueWith call as a readonly property so that unit tests can call Wait() on the task and go on to test the ViewModel updation.
Is this the only way to do it, is there any other cleaner option ? I am a but worried that the task exposes too many methods (like Dispose, Start) which is not intended to be exposed.
I ended up doing it old school style. Exposed a method
WaitOnLoadTask()that callsTask.Wait()instead of exposing the wholeTaskas a property.