public void CompletionHandlerIsInvoked() { var result = Substitute.For <IDebugProperty2>(); _taskExecutor.SubmitAsync(Arg.Any <Func <Task <EvaluationResult> > >(), Arg.Any <CancellationToken>(), Arg.Any <string>(), Arg.Any <Type>()) .Returns(Task.FromResult(EvaluationResult.FromResult(result))); _evaluateOp.BeginExecute(); _completionHandler .Received(1) .OnComplete(VSConstants.S_OK, result); }