public async Task GetValueProvider_ReturnsValue_IfKeyIsPresent()
        {
            // Arrange
            var values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
            {
                { "test-key", "test-value" }
            };
            var provider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await provider.GetValueAsync("test-key");

            // Assert
            Assert.Equal("test-value", result.RawValue);
        }
        public async Task GetValueProvider_ReturnsNull_WhenKeyIsNotFound()
        {
            // Arrange
            var values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
            {
                { "test-key", "value" }
            };
            var provider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await provider.GetValueAsync("not-test-key");

            // Assert
            Assert.Null(result);
        }
        public async Task ContainsPrefixAsync_ReturnsNullValue_IfKeyIsPresent()
        {
            // Arrange
            var values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
            {
                { "test-key", null }
            };
            var provider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await provider.GetValueAsync("test-key");

            // Assert
            Assert.NotNull(result);
            Assert.Null(result.RawValue);
            Assert.Null(result.AttemptedValue);
        }
        public async Task GetValueAsync_ReturnsCorrectValue_ForKnownKeys(string prefix, string expectedValue)
        {
            // Arrange
            var values = new Dictionary <string, object>
            {
                { "bar", 1 },
                { "bar.baz", 2 },
            };

            var valueProvider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await valueProvider.GetValueAsync(prefix);

            // Assert
            Assert.Equal(expectedValue, (string)result.AttemptedValue);
        }
        public async Task ContainsPrefixAsync_ReturnsNullValue_IfKeyIsPresent()
        {
            // Arrange
            var values = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase)
            {
                { "test-key", null }
            };
            var provider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await provider.GetValueAsync("test-key");

            // Assert
            Assert.NotNull(result);
            Assert.Null(result.RawValue);
            Assert.Null(result.AttemptedValue);
        }
        public async Task GetValueAsync_ReturnsCorrectValue_ForKnownKeys(string prefix, string expectedValue)
        {
            // Arrange
            var values = new Dictionary<string, object>
            {
                { "bar", 1 },
                { "bar.baz", 2 },
            };

            var valueProvider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await valueProvider.GetValueAsync(prefix);

            // Assert
            Assert.Equal(expectedValue, (string)result.AttemptedValue);
        }
        public async Task GetValueAsync_DoesNotReturnAValue_ForAKeyPrefix()
        {
            // Arrange
            var values = new Dictionary<string, object>
            {
                { "bar.baz", 2 },
            };

            var valueProvider = new DictionaryBasedValueProvider(BindingSource.Query, values);

            // Act
            var result = await valueProvider.GetValueAsync("bar");

            // Assert
            Assert.Null(result);
        }