/// <summary>
        /// extract the selector
        /// </summary>
        /// <param name="parameter"></param>
        /// <param name="context"></param>
        /// <param name="jsonNamingPolicy"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        private static ExpressionValue GetSelector <T>(ParameterExpression parameter,
                                                       RSqlQueryParser.ComparisonContext context,
                                                       JsonNamingPolicy jsonNamingPolicy)
        {
            var result = ExpressionValue.Parse <T>(parameter, context.selector().GetText(), jsonNamingPolicy);

            return(result ?? throw new ComparisonUnknownSelectorException(context));
        }
예제 #2
0
        public void ShouldBeThrowArgumentNullException()
        {
            // parameter = null
            this.Invoking((a) => ExpressionValue.Parse <Customer>(null, "test", null))
            .Should().Throw <ArgumentNullException>();

            // selector = null
            this.Invoking((a) => ExpressionValue.Parse <Customer>(Expression.Parameter(typeof(Customer)), null, null))
            .Should().Throw <ArgumentNullException>();

            // selector = string .empty
            this.Invoking((a) => ExpressionValue.Parse <Customer>(Expression.Parameter(typeof(Customer)), String.Empty, null))
            .Should().Throw <ArgumentNullException>();
        }