Ejemplo n.º 1
0
        public void GetNodeType_MatchingMethod()
        {
            var methodInfo = typeof(string).GetMethod("Concat", new[] { typeof(string), typeof(string) });

            _registry.Register(new[] { new NameBasedRegistrationInfo("Concat", mi => true) }, typeof(SelectExpressionNode));

            var result = _registry.GetNodeType(methodInfo);

            Assert.That(result, Is.SameAs(typeof(SelectExpressionNode)));
        }
Ejemplo n.º 2
0
        protected void AssertNotSupportedMethods_ByName <T> (IEnumerable <NameBasedRegistrationInfo> supportedMethodNames, params Expression <Func <T> >[] methodExpressions)
        {
            var nameBasedRegistry = new MethodNameBasedNodeTypeRegistry();

            nameBasedRegistry.Register(supportedMethodNames, typeof(object));

            foreach (var methodExpression in methodExpressions)
            {
                var methodInfo = ((MethodCallExpression)methodExpression.Body).Method;
                Assert.That(
                    nameBasedRegistry.GetNodeType(methodInfo),
                    Is.Null,
                    string.Format("Method '{0}.{1}' is supported.", methodInfo.DeclaringType.Name, methodInfo.Name));
            }
        }