Exemple #1
0
        private bool TryVerifyAll(out MockException error)
        {
            foreach (Invocation invocation in this.MutableInvocations)
            {
                invocation.MarkAsVerifiedIfMatchedBySetup();
            }

            var uninvokedSetups = this.Setups.ToArrayLive(setup => !setup.TryVerifyAll());

            if (uninvokedSetups.Length > 0)
            {
                error = MockException.UnmatchedSetups(this, uninvokedSetups);
                return(false);
            }

            foreach (var inner in this.InnerMocks.Values)
            {
                if (!inner.Mock.TryVerifyAll(out error))
                {
                    return(false);
                }
            }

            error = null;
            return(true);
        }
Exemple #2
0
        private bool TryVerifyAll(out MockException error)
        {
            var uninvokedSetups = this.Setups.ToArrayLive(setup => !setup.Invoked);

            if (uninvokedSetups.Length > 0)
            {
                error = MockException.UnmatchedSetups(this, uninvokedSetups);
                return(false);
            }

            foreach (var inner in this.InnerMocks.Values)
            {
                if (!inner.Mock.TryVerifyAll(out error))
                {
                    return(false);
                }
            }

            error = null;
            return(true);
        }