public void CanExecuteDuringAsyncExecute2()
{
var tcs = new TaskCompletionSource<object>();
var canExecute = false;
var executeCalled = false;
var command = new AsyncDelegateCommand(() =>
{
executeCalled = true;
return tcs.Task;
}, () => canExecute);
Assert.IsFalse(command.CanExecute(null));
command.Execute(null);
Assert.IsFalse(executeCalled);
canExecute = true;
Assert.IsTrue(command.CanExecute(null));
command.Execute(null);
executeCalled = false;
Assert.IsFalse(command.CanExecute(null));
command.Execute(null);
Assert.IsFalse(executeCalled);
tcs.SetResult(null);
Assert.IsTrue(command.CanExecute(null));
command.Execute(null);
Assert.IsTrue(executeCalled);
}