示例#1
0
        public void Intercept(IInvocation invocation)
        {
            invocation.Proceed();

            var matcher = (TMatcher)invocation.InvocationTarget;
            var success = (bool)invocation.ReturnValue;

            if (success)
            {
                return;
            }

            try
            {
                Errors.BadMatch(
                    matcher.actualDescription,
                    matcher.expectedDescription,
                    matcher.inverted,
                    matcher.actual,
                    invocation.Method.Name,
                    invocation.Arguments);
            }
            catch (Exception ex)
            {
                StackTraceUtil.FixStackTrace(ex);
                throw;
            }
        }
        public void Intercept(IInvocation invocation)
        {
            var matcher = (TMatcher)invocation.Proxy;

            if (ReferenceEquals(matcher.actual, null))
            {
                try
                {
                    Errors.IllegalNullActual();
                }
                catch (Exception ex)
                {
                    StackTraceUtil.FixStackTrace(ex);
                    throw;
                }
            }

            invocation.Proceed();
        }