Exemplo n.º 1
0
        public async Task SingleRecord()
        {
            var article = RandomHelper.RandomArticle();

            await _db.BulkUpsert(new[] { article.Clone() }).ConfigureAwait(false);

            Assert.IsFalse(File.Exists(BackupFile));
            Assert.IsFalse(File.Exists(SecondaryFile));
            Assert.IsTrue(File.Exists(TestFile));

            var json     = File.ReadAllText(TestFile);
            var articles = JsonConvert.DeserializeObject <ArticleCollection>(json);

            Assert.IsNotNull(articles);
            Assert.IsNotNull(articles.Articles);
            Assert.AreEqual(1, articles.Articles.Count);

            articles.Articles[0].IsEqualTo(article);
        }
Exemplo n.º 2
0
 private async Task Store(List <RecordProcessingResult> buffer)
 {
     var models = buffer.Where(pr => pr.Success).Select(pr => _converter.ToModel(pr.Record));
     await _db.BulkUpsert(models).ConfigureAwait(false);
 }