Exemplo n.º 1
0
        public void Matches_ArgumentCountMismatch_ReturnsFalse()
        {
            var predicateBuilder = new MatchInfoBuilder();
            Expression<Action<IFoo>> expression = (f) => f.Execute("SomeValue");

            var matchInfo = predicateBuilder.Build(expression);

            var invocationInfo = new InvocationInfo(
                typeof(IFoo).GetMethod("Execute", new Type[] { typeof(string) }),
                new[] { "SomeValue", "AnotherValue" });

            Assert.IsFalse(matchInfo.Matches(invocationInfo));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a <see cref="MatchInfo"/> instance from the target <paramref name="expression"/>.
 /// </summary>
 /// <param name="expression">The <see cref="LambdaExpression"/> from which to create a <see cref="MatchInfo"/> instance.</param>
 /// <returns><see cref="MatchInfo"/>.</returns>
 public static MatchInfo ToMatchInfo(this LambdaExpression expression)
 {                        
     var invocationVisitor = new MatchInfoBuilder();
     return invocationVisitor.Build(expression.Simplify());
 }                   
Exemplo n.º 3
0
        /// <summary>
        /// Creates a <see cref="MatchInfo"/> instance from the target <paramref name="expression"/>.
        /// </summary>
        /// <param name="expression">The <see cref="LambdaExpression"/> from which to create a <see cref="MatchInfo"/> instance.</param>
        /// <returns><see cref="MatchInfo"/>.</returns>
        public static MatchInfo ToMatchInfo(this LambdaExpression expression)
        {
            var invocationVisitor = new MatchInfoBuilder();

            return(invocationVisitor.Build(expression.Simplify()));
        }