Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }