예제 #1
0
        private void Verify(IMethod method)
        {
            var parameters = (from pi in method.Parameters
                              select this.Builder.CreateAnonymous(GuardClauseAssertion.GetParameterType(pi))).ToList();

            var i = 0;

            foreach (var pi in method.Parameters)
            {
                var expansion = new IndexedReplacement <object>(i++, parameters);

                var command   = new MethodInvokeCommand(method, expansion, pi);
                var unwrapper = new ReflectionExceptionUnwrappingCommand(command);
                this.BehaviorExpectation.Verify(unwrapper);
            }
        }
예제 #2
0
        private void Verify(IMethod method, bool isReturnValueIterator)
        {
            var parameters = this.GetParameters(method);

            var i = 0;

            foreach (var pi in method.Parameters)
            {
                var expansion = new IndexedReplacement <object>(i++, parameters);

                var command   = new MethodInvokeCommand(method, expansion, pi);
                var unwrapper = new ReflectionExceptionUnwrappingCommand(command);
                if (isReturnValueIterator)
                {
                    var iteratorDecorator = new IteratorMethodInvokeCommand(unwrapper);
                    this.behaviorExpectation.Verify(iteratorDecorator);
                }
                else
                {
                    this.BehaviorExpectation.Verify(unwrapper);
                }
            }
        }