public void Filter_ExcludesItself()
    {
        // Arrange
        var dictionary = new Dictionary <string, StringValues>();
        var provider   = new JQueryQueryStringValueProvider(
            BindingSource.Form,
            dictionary,
            CultureInfo.CurrentCulture);

        // Act
        var result = provider.Filter();

        // Assert
        Assert.Null(result);
    }
Esempio n. 2
0
    public Task CreateValueProviderAsync(ValueProviderFactoryContext context)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        var query = context.ActionContext.HttpContext.Request.Query;

        if (query != null && query.Count > 0)
        {
            var valueProvider = new JQueryQueryStringValueProvider(
                BindingSource.Query,
                JQueryKeyValuePairNormalizer.GetValues(query, query.Count),
                CultureInfo.InvariantCulture);

            context.ValueProviders.Add(valueProvider);
        }

        return(Task.CompletedTask);
    }