public void CreateContext_AttributeUri_Wins(string attributeConnection, string expectedConnection)
        {
            // Arrange
            var attribute = new DocumentDBAttribute
            {
                ConnectionString = attributeConnection
            };

            var mockFactory = new Mock <IDocumentDBServiceFactory>();

            mockFactory
            .Setup(f => f.CreateService(expectedConnection))
            .Returns <IDocumentDBService>(null);

            // Default ConnecitonString will come from app.config
            var config = new DocumentDBConfiguration
            {
                DocumentDBServiceFactory = mockFactory.Object
            };

            // Act
            DocumentDBAttributeBindingProvider.CreateContext(config, attribute, null);

            // Assert
            mockFactory.VerifyAll();
        }
        public void CreateContext_ResolvesNames()
        {
            // Arrange
            var resolver = new TestNameResolver();

            resolver.Values.Add("MyDatabase", "123abc");
            resolver.Values.Add("MyCollection", "abc123");

            var attribute = new DocumentDBAttribute("%MyDatabase%", "%MyCollection%");

            var config = new DocumentDBConfiguration
            {
                ConnectionString = "AccountEndpoint=https://someuri;AccountKey=some_key"
            };

            // Act
            var context = DocumentDBAttributeBindingProvider.CreateContext(config, attribute, resolver);

            // Assert
            Assert.Equal("123abc", context.ResolvedDatabaseName);
            Assert.Equal("abc123", context.ResolvedCollectionName);
        }