Ejemplo n.º 1
0
        /// <summary>
        /// A name of a method to call
        /// </summary>
        protected static string __code(Expression <Action> expression)
        {
            var converter = new DelegateExpressionToStringConverter <Action>(mi => _constantReferencedMethod?.Invoke(mi), "{0}|{1}", false);
            var result    = converter.ConvertTo(expression, typeof(string)) as string;

            return($"{{code:{result.Trim('|')}}}");
        }
Ejemplo n.º 2
0
        private void TestConversion <T>(string expected, Expression <T> expression) where T : Delegate
        {
            var converter = new DelegateExpressionToStringConverter <T>();

            Assert.Equal(expected, converter.ConvertTo(expression, typeof(string)) as string);
        }