public async Task BindModelAsync_CorrectlyBindsValidPipeDelimitedEnumArrayQuery()
        {
            var queryParamName = "test";
            IReadOnlyList <TestType> queryParamValues = new[] { TestType.How, TestType.Much };
            var queryParamString = "How|Much";
            var queryParamType   = typeof(TestType[]);

            var modelBinder   = new PipeDelimitedArrayModelBinder(new NullLogger <PipeDelimitedArrayModelBinder>());
            var valueProvider = new QueryStringValueProvider(
                new BindingSource(string.Empty, string.Empty, false, false),
                new QueryCollection(new Dictionary <string, StringValues> {
                { queryParamName, new StringValues(queryParamString) }
            }),
                CultureInfo.InvariantCulture);
            var bindingContextMock = new Mock <ModelBindingContext>();

            bindingContextMock.Setup(b => b.ValueProvider).Returns(valueProvider);
            bindingContextMock.Setup(b => b.ModelName).Returns(queryParamName);
            bindingContextMock.Setup(b => b.ModelType).Returns(queryParamType);
            bindingContextMock.SetupProperty(b => b.Result);

            await modelBinder.BindModelAsync(bindingContextMock.Object);

            Assert.True(bindingContextMock.Object.Result.IsModelSet);
            Assert.Equal((IReadOnlyList <TestType>?)bindingContextMock.Object.Result.Model, queryParamValues);
        }
        public async Task BindModelAsync_EnumArrayQuery_BindValidOnly_2()
        {
            var queryParamName    = "test";
            var queryParamString1 = "How";
            var queryParamString2 = "😱";
            var queryParamType    = typeof(IReadOnlyList <TestType>);

            var modelBinder = new PipeDelimitedArrayModelBinder(new NullLogger <PipeDelimitedArrayModelBinder>());

            var valueProvider = new QueryStringValueProvider(
                new BindingSource(string.Empty, string.Empty, false, false),
                new QueryCollection(new Dictionary <string, StringValues>
            {
                { queryParamName, new StringValues(new[] { queryParamString1, queryParamString2 }) },
            }),
                CultureInfo.InvariantCulture);
            var bindingContextMock = new Mock <ModelBindingContext>();

            bindingContextMock.Setup(b => b.ValueProvider).Returns(valueProvider);
            bindingContextMock.Setup(b => b.ModelName).Returns(queryParamName);
            bindingContextMock.Setup(b => b.ModelType).Returns(queryParamType);
            bindingContextMock.SetupProperty(b => b.Result);

            await modelBinder.BindModelAsync(bindingContextMock.Object);

            Assert.True(bindingContextMock.Object.Result.IsModelSet);
            Assert.Single((IReadOnlyList <TestType>?)bindingContextMock.Object.Result.Model);
        }