public async Task ItCanCreateAConnectionForAFile() { var fileId = await CreateFile(); var articles = await GetArticles(); var article = articles.FirstOrDefault() ?? await CreateArticle(); var request = new FortnoxApiRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret); try { var response = await ArticleFileConnectionService.CreateArticleFileConnection( request, article.ArticleNumber, fileId ); await DeleteConnection(fileId); Assert.IsNotNull(response); Assert.AreEqual(fileId, response.FileId); Assert.AreEqual(article.ArticleNumber, response.ArticleNumber); } finally { await DeleteFile(fileId); if (!articles.Any()) { await DeleteArticle(article.ArticleNumber); } } }
private async Task <ArticleFileConnection> CreateConnection() { var fileId = await CreateFile(); var articles = await GetArticles(); var article = articles.FirstOrDefault() ?? await CreateArticle(); var request = new FortnoxApiRequest(connectionSettings.AccessToken, connectionSettings.ClientSecret); return(await ArticleFileConnectionService.CreateArticleFileConnection( request, article.ArticleNumber, fileId )); }