public void TwinChangeJsonPathValidator_Failure(string jsonPath)
        {
            string errorDetails;

            Assert.False(TwinChangeJsonPathValidator.IsSupportedJsonPath(jsonPath, out errorDetails));
            Assert.NotEmpty(errorDetails);
        }
Beispiel #2
0
        static Expression Create(Expression[] args, Expression[] contextArgs)
        {
            var    inputExpression = args.FirstOrDefault() as ConstantExpression;
            string queryString     = inputExpression?.Value as string;

            if (string.IsNullOrEmpty(queryString))
            {
                throw new ArgumentException("twin_change_includes argument cannot be empty");
            }

            // Validate query string as JsonPath
            string errorDetails;

            if (!TwinChangeJsonPathValidator.IsSupportedJsonPath(queryString, out errorDetails))
            {
                throw new ArgumentException(
                          string.Format(CultureInfo.InvariantCulture,
                                        "{0}",
                                        errorDetails));
            }

            return(Expression.Call(typeof(TwinChangeIncludes).GetMethod("Runtime", BindingFlags.NonPublic | BindingFlags.Static), args.Union(contextArgs)));
        }
 public void TwinChangeJsonPathValidator_Success(string jsonPath)
 {
     Assert.True(TwinChangeJsonPathValidator.IsSupportedJsonPath(jsonPath, out _));
 }