Exemplo n.º 1
0
        public Task <IValueProvider> BindAsync(BindingContext context)
        {
            string        boundQueueName = _path.Bind(context.BindingData);
            IStorageQueue queue          = _client.GetQueueReference(boundQueueName);

            return(BindQueueAsync(queue, context.ValueContext));
        }
Exemplo n.º 2
0
        public void Bind_IfNullBindingData_Throws()
        {
            const string       queueNamePattern = "queue-{name}-with-{parameter}";
            IBindableQueuePath path             = CreateProductUnderTest(queueNamePattern);

            ExceptionAssert.ThrowsArgumentNull(() => path.Bind(null), "bindingData");
        }
Exemplo n.º 3
0
        public void Bind_IfNotNullBindingData_ReturnsResolvedQueueName()
        {
            const string queueNamePattern = "queue-{name}-with-{parameter}";
            var          bindingData      = new Dictionary <string, object> {
                { "name", "name" }, { "parameter", "parameter" }
            };
            IBindableQueuePath path = CreateProductUnderTest(queueNamePattern);

            string result = path.Bind(bindingData);

            Assert.Equal("queue-name-with-parameter", result);
        }
Exemplo n.º 4
0
        public Task <IValueProvider> BindAsync(BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            string        boundQueueName = _path.Bind(context.BindingData);
            IStorageQueue queue          = _client.GetQueueReference(boundQueueName);

            return(BindQueueAsync(queue, context.ValueContext));
        }
Exemplo n.º 5
0
        public IStorageQueue Convert(string input)
        {
            string queueName;

            // For convenience, treat an an empty string as a request for the default value.
            if (String.IsNullOrEmpty(input) && _defaultPath.IsBound)
            {
                queueName = _defaultPath.Bind(null);
            }
            else
            {
                queueName = BindableQueuePath.NormalizeAndValidate(input);
            }

            return(_client.GetQueueReference(queueName));
        }