Example #1
0
        public async Task TestDeleteArticleAsync_WithCorrectData_ShouldSetIsDeletedToTrue()
        {
            var context    = ApplicationDbContextInMemoryFactory.InitializeContext();
            var repository = new EfDeletableEntityRepository <Article>(context);

            var articleId = "asdf";
            await repository.AddAsync(new Article { Id = articleId });

            await repository.SaveChangesAsync();

            var service = new ArticlesService(repository, new ImageService());

            await service.DeleteArticleAsync(articleId);

            var articlesCount = repository.All().ToList().Count;

            Assert.Equal(0, articlesCount);
        }