public void PrimitiveKeyInfoHelper_KeyMemberSelector()
        {
            PrimitiveKeyInfoHelper builder = new PrimitiveKeyInfoHelper(typeof(int));
            Expression source = Expression.Constant(1, typeof(int));

            Expression selector = builder.CreateKeyMemberSelectorExpression(source, 0);

            int result = (int)Expression.Lambda(selector).Compile().DynamicInvoke();
            Assert.AreEqual(1, result);
        }
        public void PrimitiveTypeKeyInfoHelper_Binary()
        {
            var helper = new PrimitiveKeyInfoHelper(typeof(Binary));

            Expression<Func<BinaryEntity, Binary>> selector = x => x.Binary;

            MemberInfo[] members;

            bool res = helper.TryParseKeySelectorExpression(
                selector.Body,
                true,
                out members);

            Assert.IsTrue(res);
            Assert.AreEqual(1, members.Length);
        }
        public void PrimitiveKeyInfoHelper_KeyFactory()
        {
            PrimitiveKeyInfoHelper builder = new PrimitiveKeyInfoHelper(typeof(int));

            Expression factory = builder.CreateKeyFactoryExpression(
                Expression.Constant(1, typeof(int)));

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

            Assert.AreEqual(1, result);
        }