public async Task CreateIfNotExist_Throws_IfExceptionIsNotConflict()
        {
            // Arrange
            var mockService = new Mock <IDocumentDBService>(MockBehavior.Strict);

            mockService
            .Setup(m => m.CreateDatabaseAsync(It.Is <Database>(d => d.Id == DatabaseName)))
            .ThrowsAsync(DocumentDBTestUtility.CreateDocumentClientException(HttpStatusCode.BadRequest));

            // Act
            await Assert.ThrowsAsync <DocumentClientException>(
                () => DocumentDBAttributeBindingProvider.CreateIfNotExistAsync(mockService.Object, DatabaseName, CollectionName));

            // Assert
            mockService.VerifyAll();
        }
        public async Task CreateIfNotExist_Succeeds_IfCollectionDoesNotExist()
        {
            // Arrange
            var mockService = new Mock <IDocumentDBService>(MockBehavior.Strict);

            mockService
            .Setup(m => m.CreateDatabaseAsync(It.Is <Database>(d => d.Id == DatabaseName)))
            .ThrowsAsync(DocumentDBTestUtility.CreateDocumentClientException(HttpStatusCode.Conflict));

            mockService
            .Setup(m => m.CreateDocumentCollectionAsync(databaseUri, It.Is <DocumentCollection>(d => d.Id == CollectionName)))
            .ReturnsAsync(new DocumentCollection());

            // Act
            await DocumentDBAttributeBindingProvider.CreateIfNotExistAsync(mockService.Object, DatabaseName, CollectionName);

            // Assert
            mockService.VerifyAll();
        }
        public async Task CreateIfNotExist_Succeeds_IfDbAndCollectionDoNotExist()
        {
            // Arrange
            var mockService = new Mock <IDocumentDBService>(MockBehavior.Strict);

            mockService
            .Setup(m => m.CreateDatabaseAsync(It.Is <Database>(d => d.Id == DatabaseName)))
            .ReturnsAsync(new Database());

            mockService
            .Setup(m => m.CreateDocumentCollectionAsync(databaseUri, It.Is <DocumentCollection>(d => d.Id == CollectionName)))
            .ReturnsAsync(new DocumentCollection());

            // Act
            await DocumentDBAttributeBindingProvider.CreateIfNotExistAsync(mockService.Object, DatabaseName, CollectionName);

            // Assert
            mockService.VerifyAll();
        }