public void TupleKeyInfoHelper_KeyMemberSelector()
        {
            TupleKeyInfoHelper builder = new TupleKeyInfoHelper(typeof(Tuple <int, string>));

            Expression source    = Expression.Constant(Tuple.Create(1, "2"));
            Expression selector1 = builder.CreateKeyMemberSelectorExpression(source, 0);
            Expression selector2 = builder.CreateKeyMemberSelectorExpression(source, 1);

            int    result1 = (int)Expression.Lambda(selector1).Compile().DynamicInvoke();
            string result2 = (string)Expression.Lambda(selector2).Compile().DynamicInvoke();

            Assert.AreEqual(1, result1);
            Assert.AreEqual("2", result2);
        }
        public void TupleKeyInfoHelper_KeyMemberSelectorLarge()
        {
            var tuple = new Tuple <int, int, int, int, int, int, int, Tuple <int, int> >(
                1, 2, 3, 4, 5, 6, 7, new Tuple <int, int>(8, 9));

            TupleKeyInfoHelper builder = new TupleKeyInfoHelper(tuple.GetType());

            Expression source   = Expression.Constant(tuple);
            Expression selector = builder.CreateKeyMemberSelectorExpression(source, 7);

            int result = (int)Expression.Lambda(selector).Compile().DynamicInvoke();

            Assert.AreEqual(8, result);
        }