Example #1
0
        public void Invalid_Property()
        {
            Person person = null;
            Expression <Func <object> > expression = () => person.Name.ToString();

            Exception ex = Assert.Throws <ArgumentException>(() => ExpressionProcessor.GetProperties(expression.Body));

            Assert.Equal("Invalid expression.", ex.Message);
        }
Example #2
0
        public void Get_Properties()
        {
            Person person = null;
            Expression <Func <object> > expression = () => person.Id;

            var properties = ExpressionProcessor.GetProperties(expression.Body);

            Assert.Equal("person.Id", string.Join('.', properties.Select(x => x.Name)));
        }