コード例 #1
0
ファイル: Setup.cs プロジェクト: mujdatdinc/moq4
        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);
            }
        }
コード例 #2
0
        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);
        }