How to unit test RelayCommand that Executes an async method?
17:43 18 Mar 2015

As there is no RelayCommandAsync (at least not that I know of), how to test this scenario. For example:

public RelayCommand LoadJobCommand
{
    get
    {
        return this.loadJobCommand ?? (
            this.loadJobCommand =
            new RelayCommand(
                this.ExecuteLoadJobCommandAsync));
    }
}

private async void ExecuteLoadJobCommandAsync()
{
   await GetData(...);
}

Test:

vm.LoadJobCommand.Execute()

Assert.IsTrue(vm.Jobs.Count > 0)
c# unit-testing asynchronous mvvm-light .net-4.5.2