Beispiel #1
0
        /// <summary>
        ///     Returns string representation of method's return value;
        /// </summary>
        /// <param name="trueUi_FalseInternal"></param>
        /// <returns></returns>
        public string FormateReturnValue(bool trueUi_FalseInternal)
        {
            this.RequirePostExecutionPhase();

            string retValStr = InterceptedMethodParamMetadata.FormatParamValue(
                this.InterceptedCallMetaData.MethodReturnType,
                this.GetReturnValueInternal(this.InterceptedCallMetaData.IsReturnValueSecret),
                trueUi_FalseInternal);

            return(retValStr);
        }
        public string FormatReturnResult(object returnedResult, bool trueUi_FalseInternal)
        {
            if (this.IsReturnValueSecret)
            {
                returnedResult = new SecretValueHash(returnedResult);
            }

            Type retType = returnedResult == null ? this.MethodReturnType : returnedResult.GetType();

            string returnValueStr = InterceptedMethodParamMetadata.FormatParamValue(retType, returnedResult, trueUi_FalseInternal);

            return(returnValueStr);
        }
        private string FormatThisValue(ParamValueOutputOptions valueOutputOptions)
        {
            if (this.IsStaticMethod || valueOutputOptions == ParamValueOutputOptions.NoValue || this.IsReturnResultInvariant)
            {
                return(string.Empty);
            }

            object val  = this.methodInstance;
            Type   type = val == null ? null : val.GetType();

            string thisValueStr = InterceptedMethodParamMetadata.FormatParamValue(type, val, valueOutputOptions == ParamValueOutputOptions.SlowUIValue);

            return(string.Format("[this = {0}] ", thisValueStr));
        }
        private void InitParameterMetadata()
        {
            ParameterInfo[] paramData = this.MethodReflectionInfo.GetParameters();

            for (int i = 0; i < paramData.Length; i++)
            {
                Expression paramExpression = this.interceptedMethodExpression.Arguments[i];

                bool canEvaluate = this.CanEvaluateParamValue(i, paramData[i], paramExpression);

                var paramMetadata = new InterceptedMethodParamMetadata(paramData[i], paramExpression, this.methodInstance, !canEvaluate);
                this.Params.Add(paramMetadata);
            }
        }