public void TryCreate_DelegatesToExtensions()
        {
            DefaultExtensionRegistry extensions = new DefaultExtensionRegistry();
            TableArgumentBindingExtensionProvider provider = new TableArgumentBindingExtensionProvider(extensions);

            // before binding extensions are registered for these types,
            // the provider returns null
            
            Assert.Null(provider.TryCreate(_parameters[0]));
            Assert.Null(provider.TryCreate(_parameters[1]));
            Assert.Null(provider.TryCreate(_parameters[2]));

            // register the binding extensions
            FooBarTableArgumentBindingExtensionProvider fooBarExtensionProvider = new FooBarTableArgumentBindingExtensionProvider();
            BazTableArgumentBindingExtensionProvider bazExtensionProvider = new BazTableArgumentBindingExtensionProvider();
            extensions.RegisterExtension<ITableArgumentBindingExtensionProvider>(fooBarExtensionProvider);
            extensions.RegisterExtension<ITableArgumentBindingExtensionProvider>(bazExtensionProvider);
            provider = new TableArgumentBindingExtensionProvider(extensions);

            ITableArgumentBinding binding = provider.TryCreate(_parameters[0]);
            Assert.Same(typeof(IFoo), binding.ValueType);

            binding = provider.TryCreate(_parameters[1]);
            Assert.Same(typeof(IBar), binding.ValueType);

            binding = provider.TryCreate(_parameters[2]);
            Assert.Same(typeof(IBaz), binding.ValueType);
        }
        public async Task TryCreate_ReturnsTableArgumentBindingExtensionWrapper()
        {
            DefaultExtensionRegistry extensions = new DefaultExtensionRegistry();
            FooBarTableArgumentBindingExtensionProvider fooBarExtensionProvider = new FooBarTableArgumentBindingExtensionProvider();
            extensions.RegisterExtension<ITableArgumentBindingExtensionProvider>(fooBarExtensionProvider);

            TableArgumentBindingExtensionProvider provider = new TableArgumentBindingExtensionProvider(extensions);

            ITableArgumentBinding binding = provider.TryCreate(_parameters[0]);
            Assert.Equal(typeof(TableArgumentBindingExtensionProvider.TableArgumentBindingExtension), binding.GetType());

            Assert.Null(BoundTable);
            CloudTable table = new CloudTable(new Uri("http://localhost:10000/test/table"));
            IStorageTable storageTable = new StorageTable(table);
            FunctionBindingContext functionContext = new FunctionBindingContext(Guid.NewGuid(), CancellationToken.None, new StringWriter());
            ValueBindingContext context = new ValueBindingContext(functionContext, CancellationToken.None);
            IValueProvider valueProvider = await binding.BindAsync(storageTable, context);
            Assert.NotNull(valueProvider);
            Assert.Same(table, BoundTable);
        }