public void Execute(Invocation invocation) { // update this setup: this.flags |= Flags.Matched; // update invocation: invocation.MarkAsMatchedBy(this); this.SetOutParameters(invocation); // update condition (important for `MockSequence`) and matchers (important for `Capture`): this.Condition?.SetupEvaluatedSuccessfully(); this.expectation.SetupEvaluatedSuccessfully(invocation); if (this.expectation.HasResultExpression(out var awaitableFactory)) { try { this.ExecuteCore(invocation); } catch (Exception exception) { invocation.Exception = exception; } finally { invocation.ConvertResultToAwaitable(awaitableFactory); } } else { this.ExecuteCore(invocation); } }
public void Execute(Invocation invocation) { // update this setup: this.flags |= Flags.Matched; // update invocation: invocation.MarkAsMatchedBy(this); this.SetOutParameters(invocation); // update condition (important for `MockSequence`) and matchers (important for `Capture`): this.Condition?.SetupEvaluatedSuccessfully(); this.expectation.SetupEvaluatedSuccessfully(invocation); this.ExecuteCore(invocation); }