Exemple #1
0
        public async Task GetKeysFromPrefixAsync_UnknownPrefix_ReturnsEmptyDictionary()
        {
            // Arrange
            var valueProvider = new ReadableStringCollectionValueProvider <TestValueProviderMetadata>(_backingStore, null);

            // Act
            var result = await valueProvider.GetKeysFromPrefixAsync("abc");

            // Assert
            Assert.Empty(result);
        }
Exemple #2
0
        public async Task GetKeysFromPrefixAsync_KnownPrefix_ReturnsMatchingItems()
        {
            // Arrange
            var valueProvider = new ReadableStringCollectionValueProvider <TestValueProviderMetadata>(_backingStore, null);

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

            // Assert
            var kvp = Assert.Single(result);

            Assert.Equal("baz", kvp.Key);
            Assert.Equal("bar.baz", kvp.Value);
        }
Exemple #3
0
        public async Task GetKeysFromPrefixAsync_EmptyPrefix_ReturnsAllPrefixes()
        {
            // Arrange
            var expected = new Dictionary <string, string>
            {
                { "bar", "bar" },
                { "foo", "foo" },
                { "null_value", "null_value" },
                { "prefix", "prefix" }
            };
            var valueProvider = new ReadableStringCollectionValueProvider <TestValueProviderMetadata>(_backingStore, culture: null);

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

            // Assert
            Assert.Equal(expected, result.OrderBy(kvp => kvp.Key));
        }
        public async Task GetKeysFromPrefixAsync_UnknownPrefix_ReturnsEmptyDictionary()
        {
            // Arrange
            var valueProvider = new ReadableStringCollectionValueProvider(BindingSource.Query, _backingStore, null);

            // Act
            var result = await valueProvider.GetKeysFromPrefixAsync("abc");

            // Assert
            Assert.Empty(result);
        }
        public async Task GetKeysFromPrefixAsync_EmptyPrefix_ReturnsAllPrefixes()
        {
            // Arrange
            var expected = new Dictionary<string, string>
            {
                { "bar", "bar" },
                { "foo", "foo" },
                { "null_value", "null_value" },
                { "prefix", "prefix" }
            };
            var valueProvider = new ReadableStringCollectionValueProvider(BindingSource.Query, _backingStore, culture: null);

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

            // Assert
            Assert.Equal(expected, result.OrderBy(kvp => kvp.Key));
        }
        public async Task GetKeysFromPrefixAsync_KnownPrefix_ReturnsMatchingItems()
        {
            // Arrange
            var valueProvider = new ReadableStringCollectionValueProvider(BindingSource.Query, _backingStore, null);

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

            // Assert
            var kvp = Assert.Single(result);
            Assert.Equal("baz", kvp.Key);
            Assert.Equal("bar.baz", kvp.Value);
        }