Ejemplo n.º 1
0
        public async Task ContainsPrefixAsync_ReturnsFalse_IfKeyIsNotPresent()
        {
            // 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.ContainsPrefixAsync("not-test-key");

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

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

            // Assert
            Assert.True(result);
        }
Ejemplo n.º 3
0
        public async Task ContainsPrefixAsync_ReturnsFalse_IfKeyIsNotPresent()
        {
            // Arrange
            var values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
            {
                { "test-key", "test-value" }
            };
            var provider = new DictionaryBasedValueProvider(values);

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

            // Assert
            Assert.False(result);
        }
        public async Task ContainsPrefixAsync_ReturnsTrue_ForKnownPrefixes(string prefix)
        {
            // Arrange
            var values = new Dictionary<string, object>
            {
                { "foo", 1 },
                { "bar.baz", 1 },
            };

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

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

            // Assert
            Assert.True(result);
        }
        public async Task ContainsPrefixAsync_ReturnsTrue_ForKnownPrefixes(string prefix)
        {
            // Arrange
            var values = new Dictionary <string, object>
            {
                { "foo", 1 },
                { "bar.baz", 1 },
            };

            var valueProvider = new DictionaryBasedValueProvider <TestValueProviderMetadata>(values);

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

            // Assert
            Assert.True(result);
        }