Esempio n. 1
0
        public async Task DeleteAsync()
        {
            var article = Builder <Article> .CreateNew().Build();

            _articleRepositoryMock.Setup(p => p.DeleteAsync(1))
            .Returns(Task.CompletedTask);


            await _articleRepository.DeleteAsync(1);

            _articleRepositoryMock.Verify(r => r.DeleteAsync(1));
        }
Esempio n. 2
0
        public async Task Delete_TestArticle_Deletes()
        {
            AddTestArticleToDb();

            using (ArticleContext actContext = CreateDbContext())
            {
                ArticleRepository repo = new ArticleRepository(actContext);

                await repo.DeleteAsync(1);

                await actContext.SaveEntitiesAsync();
            }

            using (ArticleContext assertContext = CreateDbContext())
            {
                Assert.Empty(assertContext.ArticleModels);
            }
        }